Torbjorn Tyridal schrieb:
> I'm using comtypes (0.5.2) with the DSF
> (http://www.microsoft.com/whdc/devtools/DSF.mspx), and it seems to me
> that the generated prototypes for methods requiring object pointers
> are wrong.
> 
> It seems valid for all methods related to DSF, and example is
> ISoftUSBStrings.Add(...):
> 
> ISoftUSBStrings.Add is generated to take parameter POINTER(SoftUSBString)
> however, I can not find a way to pass that object ? All I have is a
> ISoftUSBString reference.
> 
> Changing the generated prototype to POINTER(ISoftUSBString) makes
> everything work.

We have to look at the IDL definition of the interface.

What is ISoftUSBString in the IDL (I assume a COM interface) and what is
SoftUSRString in the IDL (I assume a coclass)?


> Am I overlooking a cast_to_object_implementing_interface function or
> is that a bug in the code generator?
> 
> trigger code:
> import comtypes.client as cc
> 
> usbdev = cc.CreateObject("SOFTUSB.SoftUSBDevice")
> 
> usbstr = comc.CreateObject("SOFTUSB.SoftUSBString")
> usbstr.Value = "my string"
> 
> #This will cast an typeError exception before changing the generated prototype
> usbdev.Strings.Add(usbstr,1)
> 


-- 
Thanks,
Thomas


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to