Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Idle Loop Processing conundrum

$
0
0

In the MSDN topic for "Idle Loop Processing" for VS2010 at http://msdn.microsoft.com/en-us/library/3dy7kd92%28v=vs.100%29.aspx, it basically gives this code at the beginning:

MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
   {
      if (!AfxGetApp()->PumpMessage())
      {
         ::PostQuitMessage(0);
         break;
      }
   } 

This does not make sense to me. The AfxGetApp()->PumpMessage() returns FALSE when a WM_QUIT message is received. But then when a WM_QUIT message is received the code calls 'PostQuitMessage(0)' which tells me that "the function posts a WM_QUIT message to the thread's message queue and returns immediately". So how can this be correct if the response to a WM_QUIT message is to post another WM_QUIT message ?

Either the doc is incorrect or I am missing something about this idle loop.




Viewing all articles
Browse latest Browse all 15302


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>