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

Sumeet Sobti sumeet_sobti at yahoo.com
Fri Feb 10 00:31:25 CET 2006


--- Mark Hammond <mhammond at skippinet.com.au> wrote:

> > STDMETHODIMP CTTOrderSelector::AddTest(LPCSTR
> > lpProperty, VARIANT vValue)
> >
> > LPCSTR is not a valid COM type, but somehow it is
> > correctly handled in C#. The authors claim that
> their
> > C# client code has been tested and is known to
> work
> > correctly.
> 
> I assume that the C# implementation is using the
> vtable interfaces and
> making the call directly - ie, *not* going via
> IDispatch.
> 
> Can they show an early-bound VB example that works,
> or anything else that
> will go via IDispatch?
> 
> There aren't any hacks I can think of - maybe ctypes
> could work.
> 

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)

Otherwise, I'll have to re-code all of my objects and
their events using ctypes, which probably won't be
pleasant since there seems to be so little
documentation on ctypes..

Thanks!

-Sumeet.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Python-win32 mailing list