Win32 COM: Passing NULL as a value
William Wicker
william_wicker at spectratechnologies.com
Sat Feb 17 15:48:37 EST 2001
aleaxit at yahoo.com (Alex Martelli) wrote in
<96lag10eee at news2.newsguy.com>:
>"Mark Hammond" <MarkH at ActiveState.com> wrote in message
>news:3A8DBDC4.4040705 at ActiveState.com...
>> William Wicker wrote:
>>
>> > I am trying to work via the COM interface to an object that exposes
>> > a method something like this:
>> >
>> > AnObject.DoSomething(doWhat, toWho)
>> >
>> > where toWho is either a dispatch pointer, or NULL, if toWho is not
>> > significant.
>> >
>> > When I try to do this with
>> >
>> > obj = win32com.client.Dispatch("AnObject")
>> > obj.DoSomething("kick", None)
>>
>> None is used to pass a variant with VT_NULL. It works for every
>> object I
>have come across, so I am afraid I have no idea.
>
>If the AnObject used canonical API's to handle its arguments
>(VariantChangeType, directly or under the covers) it should
>indeed work -- a VariantChangeType from VT_NULL to VT_DISPATCH
>should succeed and give a VARIANT with pdispVal of 0. So, I
>guess from the symptoms described that AnObject is not being
>'canonical' in its handling of arguments.
>
Urgh.
I wish I were more suprised by this answer. Thanks to you and Mark.
William.
More information about the Python-list
mailing list