James Teh schrieb:
> Hi all,
> 
> I am a little confused about the "this" parameter to COM events.
> 
> When one wants to receive COM events, one does something like the following:
> self._advise = comtypes.client.GetEvents(self._server, Sink())
> where the Sink class has methods such as:
> def onEvent(self, this, arg1, arg2):
>       ...
> 
> However, it seems that there has recently been a change in the way 
> "this" is handled. (I am not sure what version of comtypes this occurred 
> in, but I suspect 0.5.1.) It seems that the name "this" is somehow 
> special. If the exact parameter name "this" is not present as the first 
> argument, the event seems to work fine without it. For example, the 
> following works:
> def onEvent(self, arg1, arg2):
> However, this does not work:
> def onEvent(self, this, arg2):
> It would seem that the "this" parameter is now optional. Unfortunately, 
> with another COM server, if "this" is present at all, the event function 
> is not fired.
> 
> Can anyone provide some clarification as to the status of the "this" 
> parameter in comtypes 0.5.2? Is "this" now optional? Is the name "this" 
> special?

Just yesterday I answered mostly the same question, see the last post in the 
thread
'returning HResult value from event handlers'.

In short: Yes, behaviour has changed between 0.4 and 0.5;
yes the name 'this' is special; yes it is optional, but if you still
use the 'this' parameter (with exactly that name) then the behaviour
should be the same in 0.4 and 0.5 .

-- 
Thanks,
Thomas


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to