title: MFC Child Dialog that behaves like a popup (upgrade From VC6 change)
body: <p>I have a MFC project I maintain, that recently got upgraded from VC6->2013, and apparently some core Windows code become stricter with regards <code>WS_POPUP</code> and <code>WS_CHILD</code>, can no longer be mixed. I have a program that crates a child dialog to alter some settings (of an image for example), the child dialog would have top level focus, and this child dialog would also spin off 2 new <code>CWnd</code> of it's own a essentially preview and result window, with the following <code>dwStyle</code> flags set <code>WS_POPUP | WS_CAPTION |  WS_CHILD</code> which worked in VC6, but now is a no no. 
  The full window create logic, </p>
  
  <pre><code>m_wndDst = new CWnd;
  m_wndDst-&gt;CreateEx(WS_EX_CONTROLPARENT , NULL,
                               szTitle, WS_POPUP | WS_CHILD | WS_BORDER | WS_CAPTION, 
                               10, 10, 10, 10, m_hWnd, NULL, NULL);
  </code></pre>
  
  <p>This child dialog will often destroy and re-create these child <code>CWnd</code>s it's perhaps not the best solution, but it's a fairly large legacy project, that I wish to disturbe the least amount as possible.</p>
  
  <p>So I remove the <code>WS_POPUP</code> per another S.O QA, but that isn't quite right either, because now my CWnds are now being renderws within my initial child dialog,clipped and have z-order issues with regards to controls, this is no good, even if it makes sense, If I change the <code>hWndParent</code> param in <code>CrateEx</code> to the top level Parent <code>hWnd</code>, this is closer to what I want, but my initial child dialog still has focus, and the contents of my 2 sub windows does not get rendered (essentially transparent), the title is there, the border is there, but no content, and the <code>CWnd</code>s can not be selected and freely moving around. </p>
  
  <p>I've tried removing the <code>WS_CHILD</code> style, and leaving the <code>WS_POPUP</code>, but that is no good either, as in wincore.cpp the <code>PreCreateWindow</code> does a check to ensure that it is a child window, </p>
  
  <pre><code>    if (cs.lpszClass == NULL)
      {
          // make sure the default window class is registered
          VERIFY(AfxDeferRegisterClass(AFX_WND_REG));
  
          // no WNDCLASS provided - use child window default
          ASSERT(cs.style &amp; WS_CHILD);
          cs.lpszClass = _afxWnd;
      }
  </code></pre>
  
  <p>So in essence what I am trying to achieve is, I need my initial child dialog to be able to spin up to <code>CWnd</code>s that act more like popup windows, titlebar, and a border, and really nothing else. They has need to be at the same focus level as the child dialog that created them (the main frame is untouchable until the child dialog is closed), if the child dialog closes, it would close the 2 <code>CWnd</code>s as well,  and like before should be able to move out side of the main frame.</p>
  
  <p>Any help, articles, suggestions would be greatly appreciated. </p>
  
  <p><strong>EDIT 1</strong> <em>based on comments ---</em>
  this gets me close really close, just have re-draw issues. </p>
  
  <pre><code>//auto dwStyle = WS_POPUP | WS_CHILD | WS_BORDER | WS_CAPTION; // original
      auto dwStyle = WS_BORDER | WS_CAPTION | WS_VISIBLE;
      //auto dwStyle = WS_CHILD | WS_BORDER | WS_CAPTION | WS_VISIBLE;
  
      CString sClass = AfxRegisterWndClass(
              CS_VREDRAW | CS_HREDRAW,
              ::LoadCursor(nullptr, IDC_ARROW),
              static_cast&lt;HBRUSH&gt;(::GetStockObject(WHITE_BRUSH)),
              ::LoadIcon(nullptr, IDI_APPLICATION));
  
      auto result = pWndSrcOrDest-&gt;CreateEx(WS_EX_CONTROLPARENT, sClass,
          sWindowTitle, dwStyle, 10, 10, 10, 10, this-&gt;m_hWnd, nullptr, nullptr);
  </code></pre>