Hello again,
Thank you very much for that suggestion. It turned out to be a solution. The 
application is now getting events perfectly.

Thanks again,
Jason.
----- Original Message ----- 
From: "Thomas Heller" <[EMAIL PROTECTED]>
To: <comtypes-users@lists.sourceforge.net>
Sent: Thursday, November 22, 2007 6:49 PM
Subject: Re: [comtypes-users] event sink problems


> Jason SW schrieb:
>> Hello all,
>>
>> My name is Jason SW, and I am new to this mailing list. I am writing
>> concerning a problem I am currently having with comtypes. I am currently 
>> in
>> an internship with a company who wants me to modify an open-source 
>> program
>> to work with the products they produce, using their COM server. I was 
>> able
>> to get it to send commands to the COM server, but the problem starts when 
>> I
>> attempt to get events from the COM server. I have tried using both 
>> GetEvents
>> with my own sink class, and ShowEvents for debugging, but it just sits 
>> there
>> like nothing is happening. I saw something about sink interfaces being
>> bugged, or something similar. Is there currently a bug of that type? I'm
>> just trying to figure out if it's something I'm doing wrong, or if 
>> there's a
>> bug that is beyond my control. I have tried asking other employees, but 
>> none
>> of them have much experience with Python, so help would be greatly
>> appreciated.
>
> This can be the usual problem that you need to process windows events (so 
> that COM
> events work) when you are running in a single-threaded appartment which is 
> the default.
>
> You must run a messageloop otherwise COM events are not delivered.
> If you have pywin32 installed, this should work:
>
> ...
> connection = ShowEvents(myobj)
> import pythoncom; pythoncom.PumpMessages()
>
> comtypes 0.4.0 contains even better code that you can also use, it is 
> carefully
> hidden ;-) in a test case:
>
> ...
> connection = ShowEvents(myobj)
> from comtypes.test.test_showevents import pump_messages
> pump_messages(10000)
>
> The pump_messages function takes an integer which specifies the timeout
> for this function, in milliseconds.  The advantage of this function 
> against
> pythoncom.PumpMessages() is that you can interrupt the message loop with
> pressing CTRL+C, and that it has the timeout parameter.
>
> Thomas
>
> PS: I think the comtypes.client module should expose this function,
> it will be named PumpEvents(), and it will take the timeout parameter
> in (possibly frational) seconds.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> comtypes-users mailing list
> comtypes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/comtypes-users
>
> __________ NOD32 2679 (20071122) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to