Well, showing a window in another thread is a big no-no! Always show the UI in your UI thread. If your worker thread needs to show some UI, it needs to notify the UI thread (in a safe manner) to let it show the dialog.
Removing the WS_EX_APPWINDOW
style is not the solution here. You will most likely end up with weird deadlocks if you don't do it right.
Let your thread post messages to your UI window and then handle it there!
#define UWM_SHOW_UI (WM_APP + 1)
//
// In your thread procedure:
PostMessage(pThreadData->m_hWnd, UWM_SHOW_UI);
WaitForMultipleObjects(...); // Wait for both exit event (set in `OnDestroy`) and continue event.
// Handle signal... Exit or continue?
//
// In your main window message handler:
void CMyWindow::OnShowUI(WPARAM wParam, LPARAM lParam)
{
CMyDlg dlg(this);
dlg.DoModal();
//
SetEvent(m_hEventContinue); // Continue thread!
}