Hi,

I have encountered a weird problem whan trying a capture events from some 
homebrewed COM ( written in Visual Studio 6 ).

Basically using the PythonWin IDE, if I run the code through the debugger with 
a breakpoint at the PumpEvents() line, the event is detected ( once I 
have stepped through  the breakpoint ).  If I do not have the breakpoint the 
event is not detected.

The code is basically as follows:-

from comtypes.client import CreateObject, GetEvents, PumpEvents

class GCPLCEventSink(object):
    def _IPLCEvents_NotificationReceived(self,this,a,NotificationValue):
        print("Notification Received")

if __name__ == "__main__":
    progid = "XXXXXX.GC_PLC.1
    plc = CreateObject(progid)
    plc.Connect("10.0.0.2")
    sink = GCPLCEventSink()
    connection = GetEvents(self.plc, sink)
    PumpEvents(10)

The Event that I am detecting is generated externally, I am sure it is 
happening when we are blocked on the PumpEvent() call.

When I talk to the COM through Visual Basic the events seem to be detected no 
problem.  So at least superficially the COM seems OK, though clearly it may 
just be VB is just more forgiving of iffy code.

The event section of the IDL file 

dispinterface _IPLCEvents
 {
  properties:
  methods:
  [id(1), helpstring("method ServerClosed")] HRESULT ServerClosed();
  [id(2), helpstring("method NotificationReceived")] HRESULT 
NotificationReceived([in] long NotificationValue);
 };

I must admit I am not too clear what parameters should be passed to the 
_IPLCEvents_NotificationReceived() method.

Any thoughts would be most welcome.

Regards,

Calum....


      
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to