title: Focus on Modal Dialog (MFC)
body: <p>I create modal dialog like this :</p>
  
  <pre><code>CDialog dlg;
  dlg.DoModal();
  </code></pre>
  
  <p>but when window opens I can access background windows of my program (move them and close them) but I need focus only on my curent window. (I think modal dialog shouldn't behave like this)</p>
  
  <p>How can I do this?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It seems I found the reason of this behavior: before open my dialog,I open another modal dialog in CMyDlg::OnInitDialog() function, when I comment this,my dialog again became modal. But how to solve this problem? </p>
  
  <p><strong>Some code describing problem:</strong></p>
  
  <pre><code>void CMyView::OnSomeButtonPress() 
  {
      CMyDlg dlg;
      dlg.DoModal();
  }
  
  BOOL CMyDlg::OnInitDialog() 
  {
      CDialog::OnInitDialog();
  
      //some init here...
  
  
      //new modal dialog here (if comment this CMyDlg works as modal)
      CSettingsDlg dlg;
      dlg.DoModal();
  
      //...
   }
  </code></pre>