[pywin32-bugs] [ pywin32-Feature Requests-1635317 ] Waiting for COM-events
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2007-01-15 10:19:22
|
Feature Requests item #1635317, was opened at 2007-01-15 06:35 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=1635317&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: com Group: None >Status: Closed >Resolution: Works For Me Priority: 5 Private: No Submitted By: bluescreen (bluescr33n) Assigned to: Nobody/Anonymous (nobody) Summary: Waiting for COM-events Initial Comment: Hello, I'm new to pywin32 and win32 programming in general, so maybe I'm missing something. In the OfficeEvents Example there is a function like this: def _WaitForFinish(): while 1: pythoncom.PumpWaitingMessages() stopEvent.wait(.2) if stopEvent.isSet(): stopEvent.clear() break While this works, I don't like the artificial delay introduced by Event.Wait() Since the COM-application "hangs" after producing an event, and PumpWaitingMessages() is needed to unfreeze it again, it would be nicer to just hang to some sort of Queue-object belonging to the COM-Message-queue instead of polling. Polling creates overhead when the delay is too short, or Application-lag when the delay is too long. I would like to see a construction like this: def _WaitForFinish(): while 1: WaitforMessage() pythoncom.PumpWaitingMessages() if stopEvent.isSet(): stopEvent.clear() break Maybe something like my made-up WaitforMessage already exists, or there already is some other way to accomplish what I want (GUI-like event-loop) that I'm not aware of, in that case I would like to hear more about it. btw: for any comments/answers/questions please email me at blu...@gm... since I don't check SF that often. ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2007-01-15 21:19 Message: Logged In: YES user_id=14198 Originator: NO These are just demo scripts. Real-world apps would use something smarter - often using MsgWaitForMultipleObjects. The "Pump*" methods are just implementations of a "standard" message loop - if you prefer, you can use win32gui to roll your own version from the ground up. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=1635317&group_id=78018 |