px schrieb:
> Hi All,
> 
> We are trying to make a call to a method which has the following COMMETHOD
> definition:
> 
>     COMMETHOD([dispid(13), helpstring(u'method PopMessage')], HRESULT,
> 'PopMessage',
>               ( ['in', 'out'], POINTER(AACDMAMessageEnum), 'MessageType' ),
>               ( ['in', 'out'], POINTER(AAProtocolEnum), 'Protocol' ),
>               ( ['in', 'out'], POINTER(c_int), 'PN' ),
>               ( ['in', 'out'], POINTER(c_int), 'CDMAChannel' ),
>               ( ['in', 'out'], POINTER(AACodeChannelEnum), 'CodeChannel' ),
>               ( ['in', 'out'], POINTER(BSTR), 'TimeStamp' ),
>               ( ['in', 'out'], POINTER(BSTR), 'Description' ),
>               ( ['retval', 'out'], POINTER(POINTER(ICDMAMessage)), 'Message'
> )),
> 
> What we are finding is that the return result is a tuple, however the
> POINTER(POINTER(ICDMAMessage)) parameter is missing from the returned
> tuple.  All other elements are there.
> 
> Now if I modify the definition and change the ['retval', 'out'] to a ['in',
> 'out'] then it works nicely and all items are returned in the tuple.

Yes, this is a complicated bug in ctypes.  ctypes provides the machinery
for calling the COM methods that comtypes uses.
The bug is difficult to understand and to fix.

Hopefully I find the time for a bugfix or (another) workaround.  I'll post
here when I have one.

> Is this a bug with comtypes?  The call we are doing is simply
> "PopMessage()".  I guess there is some ambiguity here, would passing
> pointers for each IN attribute make comtypes return Message alone?

Passing pointers for the IN parameters does not change the behaviour of
the OUT parameter.  Your hack - changing the paremeter flags of the generated
code is the easiest and best you can do at the moment.

> The behaviour with win32com is that Message is returned as the 1st item of
> the tuple, and the rest follow.

Hm, I didn't know that win32com returns the results in that order (it makes
some sense if I think of it).  comtypes returns the results in the same order
as they appear in the method definition, and does not reorder depending
on the 'retval' attribute.  It is too late to change that.

-- 
Thanks for the heads-up,
Thomas


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to