如何在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;
}
在应用程序的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;
}
相关文章推荐
- 如何使用MFC编写自定义UI界面【附高仿QQ 2014登陆界面范例程序】
- 如何判断一个已经写好的MFC程序是单文档还是多文档?
- 一个有意思的笔试题:如何破解一个简单密码登陆程序
- 如何在指定的时间内控制一个程序能否正确登陆
- MFC如何实现打开一个文件,就像安装完某个程序然后弹出一个readme.txt一样?
- mfc对话框程序如何添加背景图片以及使控件背景图片与对话框一致
- 在vs2010下如何纯手写一个MFC程序
- 如何在RCP程序中添加一个banner栏
- MFC基于对话框的程序添加菜单&点击菜单弹出一个新的对话框
- MFC 基于对话框 程序,如何添加状态栏
- MFC如何正常关闭一个程序
- 如何在mfc对话框中添加一个显示网页的窗口
- 如何在mfc对话框中添加一个显示网页的窗口 .
- 如何用VC、MFC开发一个尽可能小的程序???
- 如何让MFC程序只能运行一个?
- 如何手动写一个MFC单文档程序框架
- 《Windows小应用》如何将一个自己download的zip文件安装的程序添加到系统服务中
- vs2013中如何给一个项目添加MFC支持
- MFC如何为程序添加图标
- MFC基于对话框的程序添加菜单&点击菜单弹出一个新的对话框