导航:首页 > 版本升级 > 文件对话框创建步骤

文件对话框创建步骤

发布时间:2024-01-22 11:37:27

① MFC如何在单文档中添加对话框

首先新建一个对话框资源,初始化程序实例是由InitInstance函数完成的。因此弹出这个对话框的代码也是放在这个函数里的。
代码如下:
BOOL CDlgTestApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to rece the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
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.
CLogsys TestDlg;
if(TestDlg.DoModal()==IDOK) // 单击Ok后就开始初始化程序实例
{
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CDlgTestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CDlgTestView));
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;
}
else // 假如单击了CANCEL按钮就直接退出
return FALSE;
}
当然不是单击OK就可以进入单文档视图,在单击OK后还要进行检查用户名和密码。因此要在对话框的OnOK函数里添加相应的处理代码。
void CLogsys::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE); // 获取输入数据
if(m_strUser=="Admin"&&m_strPwd=="1234")
{
CDialog::OnOK(); // 假如用户名和密码正确,就关闭对话框
}
/*假如用户名或密码错误,且还未超出登陆次数,就进行提示*/
if((m_strUser!="Admin"||m_strPwd!="1234")&&(m_Time<3)) //假如密码和用户名正确
{
AfxMessageBox("用户名或密码不正确");
m_Time++;
}
/*假如超出登陆次数,提示并退出系统*/
if(m_Time>2)
{
AfxMessageBox("登陆错误次数超过3次");
PostQuitMessage(0);
}
}
当然在实际中功能还应进行扩充,比如3次登陆失败后就应限制这台电脑在一定时间内不能登陆等,还有比如如何验证多个用户名进行登陆等等。

② 电脑桌面怎么新建文件

1、我们先来来创建一个新自建文件夹。在桌面空白处点击鼠标右键,会出现一个窗口,点击新建。
2、这时会出现另一个窗口,在弹出的窗口里选择文件夹。
3、
这时会看到桌面上出现了一个新建文件夹,这就是我们刚才创建的文件夹,我们的目标是把零乱的图标全部收进这个文件夹里。

③ 如何在Word中加一个对话框

在Word中加一个对话框的具体步骤如下:

需要准备的材料分别是:电脑、Word文档。

1、首先打开需要编辑的Word文档,进入到编辑页面中。

阅读全文

与文件对话框创建步骤相关的资料

热点内容
win7asp配置文件 浏览:362
java网页能做心跳机制 浏览:817
逆战文件应用在哪里 浏览:102
红头文件订书红线在哪里 浏览:851
excel怎么做文件头 浏览:703
为什么word找不到文件菜单 浏览:671
ios15安装后找不到描述文件 浏览:440
学编程怎么学最有效 浏览:873
通过wifi传文件到ipad 浏览:197
js随机颜色 浏览:611
文件快速复制到u盘的软件 浏览:443
如何检查无线网络驱动是否正常 浏览:468
百度网盘来自分享的文件在哪里 浏览:127
如何发视频到腾讯视频文件夹里 浏览:510
微信打开cad外部文件找不到 浏览:882
平板可以打开各种文件后缀的软件 浏览:531
苹果微信文件怎么全选 浏览:749
手机里之前打开过的文件在哪里找 浏览:685
cad能看word文件吗 浏览:719
12306火车票系统后台数据库 浏览:570

友情链接