UI线程不能立即显示非模态对话框
w_xei 2012-08-17 04:54:07 主线程
CMyDlg::OnButton1()
{
CWinThread* pThread = AfxBeginThread(RUNTIME_CLASS(CThreadUI));
Sleep(20000);
}
UI线程内CDlgUIThread为一非模态对话框
CThreadUI::InitInstance()
{
m_pDlgUIThread = new CDlgUIThread;
m_pDlgUIThread->Create(CDlgUIThread::IDD, NULL);
m_pMainWnd = m_pDlgUIThread;
m_pDlgUIThread->ShowWindow(SW_SHOW);
}
但调用OnButton1后,必须要过20S后对话框 才显示出来。而不是立即显示出来,请高手帮忙解释一下原因