title: CWnd::CreateEx() fails after replacing WS_CHILD with WS_POPUP
body: <p>When user click a button, I would like to bring up another window. So in the OnBnClicked..() function, I added following code:</p>
  
  <pre><code>CWnd* window = new CWnd;
  BOOL result = window-&gt;CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T("Hi"), WS_CHILD | WS_VISIBLE, 0, 0, 20, 20, m_hWnd, (HMENU)1234);
  window-&gt;ShowWindow(SW_SHOW);
  </code></pre>
  
  <p>This works, except it created a child window. What I need is a separate window. So I modified the code by changing "WS_CHILD" to "WS_POPUP", and "m_hWnd" to "NULL".</p>
  
  <pre><code>CWnd* window = new CWnd;
  BOOL result = window-&gt;CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T("Hi"), WS_POPUP | WS_VISIBLE, 0, 0, 20, 20, NULL, (HMENU)1234);
  window-&gt;ShowWindow(SW_SHOW);
  </code></pre>
  
  <p>But now, the CreateEx() call returns FALSE. I would appreciate some pointer.</p>
  
  <p><strong>[Edit:]</strong></p>
  
  <p>I updated the code as following. But still seeing the same issue. Also, even when CreateEx() returns FALSE, GetLastError() actually returns 0.</p>
  
  <pre><code>CWnd* window = new CalibrationWindow;
  LPCTSTR className = NULL;
  if (!className) {
  className = AfxRegisterWndClass(
      CS_VREDRAW | CS_HREDRAW,
    ::LoadCursor(NULL, IDC_ARROW),
    (HBRUSH) ::GetStockObject(WHITE_BRUSH),
    ::LoadIcon(NULL, IDI_APPLICATION));
  }
  BOOL isValid = ::IsWindow(GetSafeHwnd());
  BOOL result = window-&gt;CreateEx(0, _T(className), _T("Hi"), WS_POPUP | WS_VISIBLE, 0, 0, 20, 20, m_hWnd, (HMENU)1234);
  DWORD errorCode;
  if (!result) {
      errorCode = GetLastError();
  }
  window-&gt;ShowWindow(SW_SHOW);
  </code></pre>