改变程序启动顺序带来的问题
我先建一个MFC的程序,这个程序是基于Single document的,能后在程序中添加一个对话框类,能后执行程序,此时程序运行时弹出视图的框架,现在我想让程序一启动先弹出一个对话框,当我按确另时在弹出视图的框架,按取消是推出程序,我是如下修改代码的,但有问题要解决:按取消时屏幕中总会闪一下那个视图的框架,怎么才能不让它闪一下而是直接推出程序?
===============我修改的代码,除此一外程序没有另何代码=================================
BOOL CTestApp::InitInstance()
{
// The one and only window has been initialized, so show and update it.
CTestdlg dlg;//Ctestdlg是我添加的对话框类
//m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce 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.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTestView));
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;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
}
else if (nResponse == IDCANCEL)
{
return FALSE;//TRUE;
}
return TRUE;
}
===============我修改的代码,除此一外程序没有另何代码=================================
BOOL CTestApp::InitInstance()
{
// The one and only window has been initialized, so show and update it.
CTestdlg dlg;//Ctestdlg是我添加的对话框类
//m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce 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.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTestView));
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;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
}
else if (nResponse == IDCANCEL)
{
return FALSE;//TRUE;
}
return TRUE;
}
...全文
相关推荐
centos7配置启动顺序
在 CentOS 7 系统中,配置启动顺序是非常重要的,因为它决定了系统开机时选择加载哪个内核版本。在多系统或内核更新后,确保设置正确的启动顺序有助于避免不必要的开机问题。
windows Linux 双系统 启动顺序更改为默认windows启动
**查看启动菜单顺序**:在开机时,注意启动菜单的选项,找出Windows XP的顺序。在这个例子中,Windows XP排在第五项,序号为4(因为是从0开始计数)。2.
延迟顺序启动程序
在正常情况下,如果服务B先于服务A启动,可能会导致服务B因找不到依赖而失败。通过设置延迟启动,我们可以确保服务A先启动并准备好,然后再启动服务B,这样就可以避免这种问题。
ubuntu和windows双系统启动顺序的修改攻略
### Ubuntu与Windows双系统启动顺序修改攻略#### 知识点概述在使用Ubuntu与Windows双系统的环境中,用户可能会遇到开机时需要手动选择操作系统的问题。
修改ubuntu开机启动项顺序 grub设置 删除多余内核
GRUB 的配置文件是 `/boot/grub/grub.cfg`,该文件定义了开机启动项的顺序和配置。用户可以通过编辑该文件来修改开机启动项的顺序和配置。


网络编程
