COM :: VARIANT -eek

Matt Smith s0199583 at sms.ed.ac.uk
Wed Aug 13 15:42:59 CEST 2003


Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<bha8cu$2q3l$1 at arachne.labyrinth.net.au>...
> Matt Smith wrote:
> > Hi, all.
> > 
> > Just a quick question, when setting a COM process to read a value from
> > a pre-defined register index, I think, I have to change the variable
> > that the value will be returned to (as I have to do for the same
> > function in perl), into a VARIANT, However when i run the variant
> > code....
> > 
> >       'serialIndex = win32com.client.pythoncom.VT_VARIANT' 
> > 
> > no matter what extension I use (i.e. VT_I4 or VT_BOOL etc etc) it
> > still returns a type mismatch error. I may be doing something wrong or
> > getting confused with variant processes in python. I do know the code
> > I use in perl to do this works but I dont know how to translate this,
> > fully, into python.
> > 
> > perl code for variant =
> > Win32::OLE::Variant::Variant(Win32::OLE::Variant::VT_VARIANT|Win32::OLE::VARIANT::VT_BYREF,
> > 0)
> 
> Unfortunately, you really can't do this in a clean way.  The best thing 
> to do is to ensure "makepy" has been run for your COM object, and the 
> right magic should always happen.
> 
> Mark.

Hi, thanks for the reply,

My problem is now this, when i go to makepy tool in pythonwin, it does
not see/recognise the type library file I want it to convert. Is there
anyway to add the file to the list of .tlb files it does does?

Cheers, 
Matt.

p.s. How do I include the generated makepy file into my code ?




More information about the Python-list mailing list