title: MFC Application running in embedded mode taking focus
body: <p>We have a MFC Application which runs in embedded mode and is invoked by through its COM interface through other applications. In the embedded mode it should not take focus but as we see it is taking up the focus and user keyboard input is changed from the current application to our MFC Application.</p>
  
  <p>I was looking for a workaround, to remove the focus as soon as the MFC application running in embedded gets the focus.</p>
  
  <p>For the workaround, I registered for the OnSetFocus() method by mapping message WM_SETFOCUS and tried to  remove the focus from my MFC application by using following window api SetWindowPos(), but that also does not help.</p>
  
  <pre><code>void CTestMFCApplicationView::OnSetFocus(CWnd* pOldWnd)
  {
     CView::OnSetFocus(pOldWnd);
     OutputDebugString(L"OnSetFocus\r\n");
     // TODO: Add your message handler code here
     CView::SetWindowPos(&amp;CWnd::wndBottom, 0, 0, 0, 0,
        SWP_NOACTIVATE);
  }
  </code></pre>