[python-win32] Problem passing a VARIANT argument to a methodof aCOM object

Mark Hammond mhammond at skippinet.com.au
Fri Feb 10 00:42:38 CET 2006


> I tried ctypes. AddTest *does* seem to work with
> ctypes.
>
> The rest of my application is written using win32com.
> Is it possible to use both win32com-dispatched COM
> objects and ctype-com-created COM objects in the same
> application, and have them interact with each other
> safely and correctly?
>
> For example, is it possible to do the following or
> equivalent:
>
> A = win32com.client.Dispatch(xxx)
> B = ctypes.com.CreateInstance(yyy)
>
> A.some_attribute = B
>
> B.some_method(A)

The above should theoretically work - although you will have 2 distinct
objects.  ie, if the above would work when using 2 objects created by
win32com, then it should work with 1 created by win32com and the other by
ctypes.

OTOH, I'd be happy for a facility so that we can pass COM objects between
ctypes and win32com - eg:

A = win32com.client.Dispatch(xxx)
B = ctypes.com.CreateInstance(A) # or something similar
# or the reverse:
A = ctypes.com.CreateInstance(xxx)
B = win32com.client.Dispatch(A)

But I'm afraid I don't have time at the moment to look at this (I've still
got about 6 unread messages from just this group all of which will take some
time to go through and action)

Mark



More information about the Python-win32 mailing list