m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();vc2010中,在initinstance函数中使用如上的语句,起始窗口并没有全屏最大化;需要点击最大化按钮两次后才全屏最大化。哪位大哥知道为什么哈?
m_pMainWnd->UpdateWindow();vc2010中,在initinstance函数中使用如上的语句,起始窗口并没有全屏最大化;需要点击最大化按钮两次后才全屏最大化。哪位大哥知道为什么哈?
没问题啊
我是在创建工程是选择了最大化窗口
不过代码就是这样了
win7旗舰版+2010旗舰版
或者最大化前 m_pMainWnd->ShowWindow(SW_NORMAL);// SW_SHOWDEFAULT
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);前者可能会造成最大化按钮或标题栏双击时界面展现的问题,需处理相应的消息后者会造成窗口闪屏及跳动的问题
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
后加 m_nCmdShow=SW_SHOWMAXMIZED //最大化 2,在*****App::InitInstance()里
m_pMainWnd-> ShowWindow(SW_SHOW);
改为m_pMainWnd-> ShowWindow(SW_SHOWMAXMIZED);3,在CMainFrame::PreCreateWindow(CREATESTRUCT& cs)中
cs.style |= WS_MAXIMIZE 4,mainframe的oncreate中加入 ShowWindow(SW_MAXIMIZE);5void CMainFrame::ActivateFrame(int nCmdShow)
{ nCmdShow = SW_MAXIMIZE; CFrameWnd::ActivateFrame(nCmdShow);
}
试试这些方法行不?
就是CFormView,不知道为什么会出现问题。
不过您给的方法还是比较管用的,就是先出现一个窗口,接着闪屏最大化。
{
/***********省略一点*******************/
// 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(CfffDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CfffView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
CleanState(_T("WorkSpace")); // Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
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-> ShowWindow(SW_SHOWMAXMIZED);
***********************************/
m_pMainWnd->UpdateWindow();
// call DragAcceptFiles only if there's a suffix
// In an SDI app, this should occur after ProcessShellCommand
return TRUE;
}
{
/***********省略一点*******************/
// 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(CfffDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CfffView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
/****************这里****************************/
CleanState(_T("WorkSpace"));/****************上面***************************/ // Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
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-> ShowWindow(SW_SHOWMAXMIZED);
***********************************/
m_pMainWnd->UpdateWindow();
// call DragAcceptFiles only if there's a suffix
// In an SDI app, this should occur after ProcessShellCommand
return TRUE;
}