BOOL CCxSkinButtonDemoApp::InitInstance()
{
AfxEnableControlContainer(); // Standard initialization#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif CCxSkinButtonDemoDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
} // Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
{
AfxEnableControlContainer(); // Standard initialization#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif CCxSkinButtonDemoDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
} // Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
CCxSkinButtonDemoDlg dlg; //为打开对话框设置一个对话框变量
m_pMainWnd = &dlg; //m_pMainWnd是“Microsoft Visual Studio\VC98\MFC\Include\AFXWIN.H”里的CWinThread类的一个公共变量
//以后直接用m_pMainWnd,就是对话框的CWnd*类句柄了。
int nResponse = dlg.DoModal(); //打开对话框
if (nResponse == IDOK)
{ }
else if (nResponse == IDCANCEL)
{ }
The Microsoft Foundation Class Library will automatically terminate your thread when the window referred to by m_pMainWnd is closed. If this thread is the primary thread for an application, the application will also be terminated. If this data member is NULL, the main window for the application's CWinApp object will be used to determine when to terminate the thread. m_pMainWnd is a public variable of type CWnd*.
之前,看msdn的解释是,应用程序线程会代替cwinapp对象,来释放线程?
int nResponse = dlg.DoModal(); //打开对话框
if (nResponse == IDOK)
{ AfxMessageBox("upspring!"); }
else if (nResponse == IDCANCEL)
{ }