> 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.

It should be, but you would need to be careful - eg, if your event handler
relied on an object that was initialized *after* you call the method.  But
best I can tell, this isn't a COM or Windows question at all, and is just
asking how Python behaves with respect to multiple inheritance?

> 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)?

I'm really not sure - we create the COM object with the name you specify,
then ask that COM object exactly what it is, then match that info with the
gencache.  ie, it is under the control of the object, not us.

Cheers,

Mark

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to