请问哪位高手能指导一下,在单文档(支持文档/视图)中制作一个类似登录框一样的东西,就是先显示对话框,处理完后,再显示整个SDI.因为选择了支持/视图后,不知道如何设计了,以前都是在CXXXAPP的
InitInstance()函数里面,添加并显示对话框,但现在好像这样是不可以的,因为对话框和SDI会同时出现,一个比较傻的方法就是
在里面添加m_pMainWnd->ShowWindow(SW_HIDE);但,画面会闪一下,很不美观,不知道还有什么办法,请指教.BOOL CTryApp::InitInstance()
{
// 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. // 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(CTryDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTryView));
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;
}
InitInstance()函数里面,添加并显示对话框,但现在好像这样是不可以的,因为对话框和SDI会同时出现,一个比较傻的方法就是
在里面添加m_pMainWnd->ShowWindow(SW_HIDE);但,画面会闪一下,很不美观,不知道还有什么办法,请指教.BOOL CTryApp::InitInstance()
{
// 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. // 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(CTryDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTryView));
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;
}
解决方案 »
- 请问如何用GDI+将JPG转成BMP?
- 如何让文本静态控件的滚动条向下滚动?
- 为什么我的程序的这段StretchDIBits总是返回的是0???
- 求一个,不用派生CListCtrl(不是listview)可以排序中文,英文,整数的代码
- 无标题栏的窗口如何表示出其具有焦点或失去焦点?
- VC2008 Combo Box 怎么使用...大神们来救救命....
- CFile 新建文件
- 怎么会这样,想不通啊!
- 进程的句柄能否跟一个完成端口对象绑定呢?
- 老是改俺的IE主页设置,请问这是怎么回事?怎样对付呢?
- 请问如何画矩形的虚边框?我用FrameRect函数,但只能画实线边框啊
- *** 如果开发一个COM, 只提供给Delphi 和 VB VC这样的程序使用, 是否有必要实现dual 和 Automation?
m_pMainWnd->UpdateWindow();
之前 if(dlg.Domodal()==IDOK) 即可
在APP头文件中,添加一个public变量bool flag;
然后在VIEW头文件中添加一个CXXAPP* p,
在CPP文件的构造函数中添加一条p=(CXXAPP*)AfxGetApp();然后改写虚函数OnInitialUpdate()在函数里面显示对话框,如
if(dlg.DoModal()!=IDOK)
{
p->flag=false;
}
else p->flag=true;在APP的InitInstance()里面,
在m_pMainWnd->ShowWindow(SW_SHOW);语句前
判断flag就可以了.