When DispatchWithEvents is used a new object is returned that (according to the code on sourceforge http://pywin32.cvs.sourceforge.net/pywin32/pywin32/com/win32com/client/__ini t__.py?revision=1.34&view=markup)
216 It is important to note that the returned instance is not a direct 217 instance of the user_event_class, but an instance of a temporary 218 class object that derives from three classes: 219 * The makepy generated class for the COM object 220 * The makepy generated class for the COM events 221 * The user_event_class as passed to this function. The responsible code appears to be this: 264 result_class = new.classobj("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) 265 instance = result_class(disp._oleobj_) # This only calls the first base class __init__. 266 events_class.__init__(instance, instance) 267 if hasattr(user_event_class, "__init__"): 268 user_event_class.__init__(instance) 269 return EventsProxy(instance) Two questions: Question 1: Is it safe in the __init__ code for the user event class to execute any methods or reference any attributes of the disp_class? In particular, I am concerned about what might happen if a method in disp_class was referenced that caused an event that would be handled by a method in user_event_class. My general sense is that this is probably NOT a good thing to do, but it turns out that it would be useful in the IE automation class I'm working on so I thought I'd at least ask before moving on to some other, presumably saner, approach. Question 2: If the user_event_class overrides a disp_class method how does one reference the disp_class method. In particular for IE if: class IE_Events(object): ... bunch of code ... def Navigate2(self, url, flags=0, targetFrameName="_self", postData="", headers="", errorFlag = True, message = None ): ... some code ... ... Now how do I reference the Navigate2 method in disp_class? ... ... How do I KNOW what disp_class is? ... Examination of the makepy output suggest that it is likely that disp_class in this instance is IWebBrowser2 but how can I KNOW that it is not some other class (for example IWebBrowser)? Thanks for any help. Regards, Richard _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32