您的位置:首页 > 其它

如何在MFC程序中添加一个登陆框

2009-08-11 14:57 519 查看
新建一个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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: