[python-win32] IE DOM ptr as input to DLL function - Doing thisright?
Mark Hammond
mhammond at skippinet.com.au
Sat Jun 30 06:46:32 CEST 2007
> I'm a newbie to Win32 COM and am unsure whether my current problem
> lies in what I'm doing or possibly in some quirk of the DLL I'm trying
> to use from Python.
>
> I have a snippet of C++ that I want to implement in Python:
>
> IDispatch* pVoid;
> m_pBrowserApp->get_Document(&pVoid);
> m_pAnalyzer->Analyze(pVoid, _variant_t(5L));
> pVoid->Release();
>
> At first, I tried using win32com.Client.Dispatch to create a COM
> object for both my DLL and for the IE browser, and that worked well up
> to the point where I tried to use the ie.Document object as input to
> Analyze where it expects the pVoid. Got "argument is not a COM
> object"
In general, COM itself doesn't understand a "void *". In the example above,
that first param would probably be best defined as IUnknown rather than
void. Further, in general, win32com only supports IDispatch based
interfaces, but the C++ example above is using vtables. If you can get your
analyzer interface working via IDispatch, it will work correctly from
Python, as well as VBScript, JS, etc...
I'm afraid I can't help with the comtypes issues...
Cheers,
Mark
More information about the Python-win32
mailing list