i've changed my "message pump" from:
--------------------------
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
--------------------------
to:
--------------------------
while( 1 )
{
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( !GetMessage( &msg, NULL, 0, 0 ) ) return msg.wParam;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if( bActive ) // if the application has the focus
{
DisplayGraph(); // display graph
}
else
{
WaitMessage();
}
}
--------------------------
/in DisplayGraph() i use FillRect, some PolyPolyLine and BitBlt;

on Win2k/XP it works well,
but on Win9x not :(.

why Win9x hungs?

Re: Why Win9x hangs on PeekMessage (and Win2k/XP not)? by Scot

Scot
Thu Jul 28 05:07:28 CDT 2005

> why Win9x hungs?

Because that family of OS's are of so little value, and MS has abandoned any attempts to repair
them. All development is on the Windows NT/2K/XP family now. Discard Win9x and give it a proper
funeral. Your time and sanity are more valuable than the small price of upgrading.



Re: Why Win9x hangs on PeekMessage (and Win2k/XP not)? by William

William
Thu Jul 28 09:08:12 CDT 2005

"Q" <q@nospam.pl> wrote in message news:dcaac4$pss$1@atlantis.news.tpi.pl...
> i've changed my "message pump" from:
> --------------------------
> while(GetMessage(&msg, NULL, 0, 0))
> {
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> --------------------------
> to:
> --------------------------
> while( 1 )
> {
> if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
> {
> if( !GetMessage( &msg, NULL, 0, 0 ) ) return msg.wParam;
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> else if( bActive ) // if the application has the focus
> {
> DisplayGraph(); // display graph
> }
> else
> {
> WaitMessage();
> }
> }
> --------------------------
> /in DisplayGraph() i use FillRect, some PolyPolyLine and BitBlt;
>
> on Win2k/XP it works well,
> but on Win9x not :(.
>
> why Win9x hungs?

I think the first step in diagnosing the problem would be to find where the
application hangs. The two most likely places are at the call to
WaitMessage() and GetMessage(). Once you know where you might want to add a
call to GetQueueStatus() there to see if there is anything in the queue.

Note this line in the docs for WaitMessage():

<quote>
Note that WaitMessage does not return if there is unread input in the
message queue after the thread has called a function to check the queue.
</quote>

That might be a clue. Just by the way you might look at re-casting the loop
as

while ( 1)
{
while ( PeekMessage() )
{
}

if ( bActive )
DisplayGraph()

else
WaitMessage()
}


Regards,
Will



Re: Why Win9x hangs on PeekMessage (and Win2k/XP not)? by Alexander

Alexander
Thu Jul 28 10:38:31 CDT 2005

What you mean by "hangs"?

"Q" <q@nospam.pl> wrote in message news:dcaac4$pss$1@atlantis.news.tpi.pl...
> i've changed my "message pump" from:
> --------------------------
> while(GetMessage(&msg, NULL, 0, 0))
> {
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> --------------------------
> to:
> --------------------------
> while( 1 )
> {
> if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
> {
> if( !GetMessage( &msg, NULL, 0, 0 ) ) return msg.wParam;
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> else if( bActive ) // if the application has the focus
> {
> DisplayGraph(); // display graph
> }
> else
> {
> WaitMessage();
> }
> }
> --------------------------
> /in DisplayGraph() i use FillRect, some PolyPolyLine and BitBlt;
>
> on Win2k/XP it works well,
> but on Win9x not :(.
>
> why Win9x hungs?
>
>
>



Re: Why Win9x hangs on PeekMessage (and Win2k/XP not)? by Q

Q
Thu Jul 28 11:13:42 CDT 2005

> > why Win9x hungs?

i mean: only hardware reset helps :(