MFC,基于单文档的构架,初始化时隐藏主窗口发生闪烁如何解决?
//CETSPApp::InitInstance()中部分代码如下:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CETSPDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CETSPView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
//---------显示指定对话框--------
CETSPTESTDlg* pETSPTESTDlg;
pETSPTESTDlg = new CETSPTESTDlg();
if (pETSPTESTDlg != NULL)
{
BOOL ret = pETSPTESTDlg->Create(IDD_ETSPTEST_Dlg, NULL);
if (!ret)
{
AfxMessageBox(_T("对话框创建失败!"));
}
pETSPTESTDlg->ShowWindow(SW_SHOW);
}
else
{
AfxMessageBox(_T("创建错误!"));
}
//---------显示指定对话框--------
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
//隐藏主窗口
m_pMainWnd->ShowWindow(SW_HIDE);
m_pMainWnd->UpdateWindow();
return TRUE;
//框架类中重载如下:
void CMainFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
nCmdShow= SW_HIDE;
CFrameWndEx::ActivateFrame(nCmdShow);
}