新建一个DIALOG,同时新建窗口类CDLGTEST
在应用程序的CCChapter13AApp::InitInstance()函数中做如下修改
即在创建主框架之前显示CDLGTEST
BOOL CCChapter13AApp::InitInstance()
{
。。。。。。。
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CDLGTEST dlgTest;
if(dlgTest.DoModal() == IDOK)
{
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCChapter13ADoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CCChapter13AView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
}
return TRUE;
}