title: Hide an MFC dialog window
body: <p>I have written an MFC dialog based application which is launched by some another application. For now, I have not added any code. It is just the default files that I got. The other application can successfully launch my application.</p>
  
  <p>I am trying to hide the window of my application when the other application launches it.</p>
  
  <pre><code>BOOL CMyApp::InitInstance()
  {
      CMyAppDlg dlg;
      m_pMainWnd = &amp;dlg;        
  
      INT_PTR nResponse = dlg.DoModal();
  
      if (nResponse == IDOK)
      {
      }
      else if (nResponse == IDCANCEL)
      { 
      }
  
      return FALSE;
  }
  </code></pre>
  
  <p>I tried to use:</p>
  
  <pre><code>dlg.ShowWindow(SW_HIDE) 
  </code></pre>
  
  <p>but it still does not hide the window.</p>
  
  <p>How can I accomplish this task?</p>