Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40047
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-02-27 02:49 -0800 |
| Message-ID | <52692a42-6cdb-4c19-9f56-7fa2f313b7c4@googlegroups.com> (permalink) |
| Subject | win32com how to catch events |
| From | igorjan2332@gmail.com |
Hello,
I have a VBS sample code that I need to rewrite into python. It calls a com object which then generates events. My problem is that I don't know how to catch this events.
VBS sample looks like this:
Set oCOV = WScript.CreateObject( "RainbowObjectHandlerSrv.RainbowCOV", "oCOV_") ' like WithEvents in VB(A)
Sub oCOV_Update( ObjectId, ObjInstDataCOV)
'some code
End Sub
I tried like this:
from win32com.client import DispatchWithEvents
class Events:
def Update(self, ObjectID, Data):
print('update event')
oCOV = DispatchWithEvents("RainbowObjectHandlerSrv.RainbowCOV", Events)
my code can be found here: http://pastebin.com/EgfippzD
but the event newer gets called. Any idea what I'm doing wrong?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
win32com how to catch events igorjan2332@gmail.com - 2013-02-27 02:49 -0800
csiph-web