Article View: comp.windows.ms
Article #2212Re: Yielding control
From: Kai-Uwe Rommel
Date: Thu, 22 Mar 1990 12:24
Date: Thu, 22 Mar 1990 12:24
27 lines
1460 bytes
1460 bytes
In article <291@emdeng.Dayton.NCR.COM> sshirk@emdeng.UUCP (Stephanie.Shirk) writes:
>
>Has anyone tried forcing an application to yield control to others? You're
>supposed to be able to do this by calling PeekMessage or GetMessage (even
>outside your message loop). I'm not having much luck! I'm also trying to
...
>Stephanie Shirk -- NCR E&M-Dayton
>email: sshirk@emdeng.Dayton.NCR.COM
You have to call TranslateMessage() and DispatchMessage() too after
calling PeekMessage() if you get a nonzero result from PeekMessage().
Use PM_REMOVE mode on PeekMessage(). I am using this sequence
successfully.
if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
If you have enough time , you can replace the if by a while. Add
TranslateAccelerator() as needed like in the main message loop.
Kai Uwe Rommel
Munich
rommel@lan.informatik.tu-muenchen.dbp.de
Technical Details
Message-ID:
<1412@tuminfo1.lan.informatik.tu-muenchen.dbp.de>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!ira.uka.de!fauern!tumuc!lan!rommelReferences:
<291@emdeng.Dayton.NCR.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!ira.uka.de!fauern!tumuc!lan!rommel From: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Newsgroups: comp.windows.ms Subject: Re: Yielding control Message-ID: <1412@tuminfo1.lan.informatik.tu-muenchen.dbp.de> Date: 22 Mar 90 12:24:00 GMT References: <291@emdeng.Dayton.NCR.COM> Sender: news@lan.informatik.tu-muenchen.dbp.de Reply-To: rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) Organization: Inst. fuer Informatik, TU Muenchen, W. Germany Lines: 27