[python-win32] FireEvent : comtypes work but win32com fails, why?

Mark Hammond mhammond at skippinet.com.au
Wed Jun 25 16:58:15 CEST 2008


Thomas:
> Mark Hammond schrieb:
> >> > In summary, there are one big problem and one minor problem. The
> >> > first
> >> > is about pywin32's inability to pass FireEvent's second argument.
> >
> > I can't explain that :(  I've stepped through the code, and it seems
> > we are passing a VT_VARIANT containing a VT_BYREF|VT_DISPATCH.  I'm 
> > afraid I'm not familiar enough with comtypes to know how it is 
> > passing that param.
> 
> I think that comtypes passes a VT_DISPATCH type in the DISPPARAMS
> VARIANTARG field.

That is what I suspected - pywin32 is adding an extra level of indirection.
When pywin32 sees VT_VARIANT, it takes it literally - it supplies a variant
of type VT_VARIANT (ie, the variant itself holds a variant), and that
"child" variant is what holds the real value.  If I understand what you are
saying, comtypes just supplies the variant with the real type directly in
place (ie, a variant with a 'vartype' of VT_VARIANT isn't ever returned by
comtypes).  Is that correct?  If so, I guess I should give that a whirl and
hope nothing else in the test suite breaks ;)

Thanks,

Mark



More information about the python-win32 mailing list