mfc对话框工程(模式对话框)与InitInstance的有关问题

mfc对话框工程(模式对话框)与InitInstance的问题
InInitInstance函数里, 只有当DoModal返回的时候,才会执行 InitInstance里函数里的 最后一句return FALSE.

m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with Cancel
}

// Since the dialog has been closed, return FALSE so that we exit the
//  application, rather than start the application's message pump.
return FALSE;   //即 只有DoModal返回后, 这一句代码才能执行。而这一句代码影响到AfxWinMain里的代码.

}


然后才进入以下代码:
// Perform specific initializations
if (!pThread->InitInstance())
{
if (pThread->m_pMainWnd != NULL)
{
TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
pThread->m_pMainWnd->DestroyWindow();
}
nReturnCode = pThread->ExitInstance();
goto InitFailure;
}
nReturnCode = pThread->Run();(内部有消息循环)



有人指出 我的理解不对,   pThread->Run 可以在  pThread->InitInstance()没执行完毕 就可以开始执行了。   

这是怎么回事???


原帖子: http://bbs.csdn.net/topics/390359424


------解决方案--------------------
>>pThread->Run 可以在  pThread->InitInstance()没执行完毕 就可以开始执行了。

不可能,谁说都是忽悠你。
RETURN FALSE 就是为了不让pThread->Run 开始。

------解决方案--------------------
执行到 INT_PTR nResponse = dlg.DoModal();
以后 在加入dlg::mousemove 就可以响应了

应该是运行run!
------解决方案--------------------
pThread->Run和对话框的runmodalloop能一样么?
我只是说没有运行pThread->Run,并没有说没有运行runmodalloop。
pThread->Run是线程的消息循环,runmodalloop是对话框的消息循环,
楼主不要搞混了。
------解决方案--------------------
http://blog.csdn.net/zhoujielunzhimi/article/details/8548669
附上我的一篇关于消息循环的理解。