title: Can't return focus to the main window after showing dialog
body: <p>I create dialog window in MFC using <code>CWnd::DoModal</code> function.
  The window is instantiated in CWinApp::OnIdle()</p>
  
  <pre><code>CPatientFile pf;
  pf.DoModal();
  </code></pre>
  
  <p>When the <code>DoModal</code> function returns the focus is not returned to the main window.
  I tried to set focus manually </p>
  
  <pre><code>AfxGetMainWnd()-&gt;SetFocus();
  </code></pre>
  
  <p>Also tried to set the main window as foreground or active.</p>
  
  <p>Generally I have touch screen, so when I close the Dialog I need to press the button on the main window to get it work.</p>
  
  <p>So what is the right way to do it?</p>