[python-win32] How to work with Dispach callback?
Alexandr N Zamaraev
tonal at promsoft.ru
Thu Feb 7 12:58:33 CET 2008
I use MicroStation through Automation interface.
Bat I do not known how use Events.
For example:
Object CommandState have method StartLocate:
Syntax
object.StartLocate EventHandlers
object A valid object.
EventHandlers An ILocateCommandEvents expression. The object that will
handle the events. An instance of the class that you've defined, which
implements ILocateCommandEvents.
How to write EventHandlers object and call CommandState.StartLocate?
I write simple:
from win32com.server.util import wrap as com_wrap
IID_ILocateCommandEvents = '{67CBDE4A-F073-11D4-A8E6-00508B4D8FED}'
class LocateCommandEvents:
_com_interfaces_ = [IID_ILocateCommandEvents]
_public_methods_ = [
'Accept', 'Cleanup', 'Dynamics', 'LocateFailed', 'LocateFilter',
'LocateReset', 'Start']
# skip dummy methods...
ev = LocateCommandEvents()
events = com_wrap(self.ev, IID_ILocateCommandEvents)
MSApp.CommandState.StartLocate(events)
But it do not work:
events = com_wrap(self.ev, IID_ILocateCommandEvents)
File "C:\Lang\Python\25\lib\site-packages\win32com\server\util.py",
line 30, in wrap
ob = ob.QueryInterface(iid) # Ask the PyIDispatch if it
supports it?
pywintypes.com_error: (-2147467262, 'The interface is not supported',
None, None)
More information about the python-win32
mailing list