It's not working, I did something wrong.


I used this code:

Code:
m_thread= new CUIThread();
m_thread->CreateThread();

// Create mutex here
...

// block here till the dialog created by the thread isn't fully loaded
while(WaitForSingleObject(m_VisualOverrideThread->thread_synchronize_mutex, INFINITE) != WAIT_OBJECT_0) {};

and the CUIThread class has this code:

Code:
BOOL CUIThread::InitInstance()
{

	// Show window
 	m_dlg = new CDlg(0, pointer_to_mutex);
	m_dlg->DoModal();

	return TRUE;
}

the mutex is then released into the OnInitDialog of the dialog.

But the problem is: the window won't show up.


Can someone suggest me a link to create another MFC thread with a window associated?

I basically need a window to act like a modal till the user won't press a key, then act like a non-modal.