Re: PostMessage and unprocessed messages
 
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> ha scritto nel messaggio 
news:uImn9ZHgIHA.5036@TK2MSFTNGP06.phx.gbl...
After WaitForSingleObject returns you can run a message loop to flush the 
queue of any pending messages.
Scott: I wrote that code after WFSO:
<code>
  //
  // Flush the queue of any WMU_WORKER_PROGRESS pending messages,
  // so we can delete the seneder's dynamically allocated data
  //
  MSG msg;
  while ( ::PeekMessage( &msg, m_hWnd, WMU_WORKER_PROGRESS, 
WMU_WORKER_PROGRESS, PM_REMOVE ) )
  {
     ATLASSERT( msg.message == WMU_WORKER_PROGRESS );
     // Extract data from lParam
     ProgressMsgData * data = (ProgressMsgData *) (msg.lParam);
     ATLASSERT(data != NULL);
     // Release heap memory
     delete data;
  }
</code>
I did some tests, and it seems to me that it worked just fine!
All dynamically allocated data is now properly released.
This solves my problem: thank you, and also thank you all!
BTW: I have only one doubt: why the debug CRT did not report me memory 
leaks?
I discovered them using my custom tracing mechanism (using ATLTRACE in 
constructor and destructors)...
Giovanni