Can't focus from main window after closing dialog from other thread
<p>I create a new <code>CWindThread</code> in <code>CWinApp::InitInstance()</code>. In that thread, I create a dialog (for displaying a progress bar in that dialog).</p>

<p>After finishing <code>InitInstance()</code>, I close the dialog by calling <code>DestroyWindow()</code> from the dialog, but the application is loosing focus from main window.</p>

<p>I used <code>AfxGetMainWnd()-&gt;SetActiveWindow();</code> to set focus for main window but it is not working.</p>

<p>How can I return the focus to the main window after closing the dialog?</p>