title: Reopen modal dialog in MFC
body: <p>I need to open a dialog box instantiated from the same class twice. When I try this</p>
  
  <pre><code>CdelmeDlg dlg;
  dlg.DoModal();
  dlg.DoModal();
  </code></pre>
  
  <p>The second call opens the dialog only for a split second, then it is closed. My bet was there is a leftover message in the message queue, so I added this in between the calls</p>
  
  <pre><code>MSG msgCur;
  while (::PeekMessage(&amp;msgCur, NULL, NULL, NULL, PM_REMOVE))
      ;
  </code></pre>
  
  <p>This solves the problem, but it feels like a wrong kind of thing to do. Is there a way to process the leftover message properly?</p>