Digest Number 5208

Bogdan Marinescu a_bogdan_marinescu at yahoo.com
Mon Nov 17 02:42:09 EST 2003


Message: 15
   Date: Sun, 16 Nov 2003 13:12:34 +1100
   From: Mark Hammond <mhammond at skippinet.com.au>
Subject: Re: Strange Python COM behaviour

> strange errors. Specifically, I try to use a COM
object that supports 
> events, and I'm instantiating it like this:
> 
>   eventobj = win32com.client.DispatchWithEvents(
crtthread, 
> DebuggerThreadEvents )
> 
>     It seems that events_class's type is str ( as
returned by 
> getevents() function in __init__.py file from
win32com/Client 
> directory) instead of 'classobj' as it is supposed
to be. event_class 
> is actually a simple string showing a CLSID. I'm new
to COM and I 
> can't understand why this is happening. Please help
me if you can. 
>     Regards,

> It looks to me as if this error could occur if the
event interface you 
> are trying to implement is not based on IDispatch. 
It looks like a bug 
> in win32com - what is the object you are trying to
use?

Thank you very much for your reply. This is crtthread:
 
<win32com.gen_py.Metrowerks CodeWarrior
IDE.ICodeWarriorDebuggerThread instance at 0x19752440>
 
This is the signature of the interface as returned by
OLE/COM Object Viewer:
 
interface ICodeWarriorDebuggerThread : IDispatch {

And this is the signature of the events interface:

interface ICodeWarriorDebuggerThreadEvents : IUnknown
{

This is the declaration of my events class:

class DebuggerThreadEvents:
  """ Handle events generated by the
ICodeWarriorDebuggerThreadEvents object """
  def ThreadDied( self, thread ):
    print '1'
  def ThreadStepped( self, thread, stepMode ):
    print '2' 
......................................

By the way, thank you for Win32 extensions, they are
GREAT! :)


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree





More information about the Python-list mailing list