python wia and RegisterEvent
gelonida at gmail.com
Fri Apr 16 17:37:49 CEST 2010
On Apr 16, 3:16 am, Mark Hammond <skippy.hamm... at gmail.com> wrote:
> On 16/04/2010 7:15 AM,gelonidawrote:
> The model used by pywin32 is more "low level" than that exposed by some
> of the MS languages. You probably need something closer to:
> class MgrHandlerClass:
> def OnEvent(self, EventID=defaultNamedNotOptArg, ...):
> print "Called back with ..."
> manager = win32com.client.DispatchWithEvents("WIA.DeviceManager",
> And magically your OnEvent should be called when the event happens.
> Googling for 'DispatchWithEvents' might find some good hits for more
I'm still stuck. Please look at following code snippet.
I tried to reduce it to the absolute minimum.
running under WinXP and python 2.6.4
A231-00C04FA31809}' # from enum EventID
class MgrHandlerClass: # doesn't work either
def OnEvent(self, EventID=defaultNamedNotOptArg,
print "Called back with ..."
manager = win32com.client.DispatchWithEvents("WIA.DeviceManager",
When I plug / unplug a USB WIA device nothing shows up.
My C# implementation prints messages on wiaEventDeviceConnected /
wiaEventDeviceDisconnected events if I register them.
What am I missing?
Should MgrHandlerClass inherit from some kind of default class?
More information about the Python-list