How to use the callback of COM objects
dale at riverhall.NOSPAMco.uk
Wed Oct 3 16:59:51 CEST 2001
"Gillou" <nospam at bigfoot.com> wrote:
>I've tried this to provide a callback function to a COM object:
> # anything you want
>ox = win32com.client.Dispatch('MSXML.DomDocument')
>ox.onreadystatechange = HandleReadyState
>And the last line raises this:
>Traceback (most recent call last):
> File "validation.py", line 7, in ?
> ox.onreadystatechange = HandleReadyState
> File "C:\Python21\win32com\client\dynamic.py", line 467, in __setattr__
> self._oleobj_.Invoke(self._olerepr_.propMapPut[attr].dispid, 0,
>SPATCH_PROPERTYPUT, 0, value)
>TypeError: Objects of type 'function' can not be converted to a COM VARIANT
>"onreadystatechange" is an event that can be handled by a user function.
>Did I miss something ?
>Thanks in advance fo any hint.
There is DispatchWithEvents which might be what you're looking for but
I've never tried to use it.
Riverhall Systems Ltd
More information about the Python-list