BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
...
cs.style = WS_OVERLAPPED | WS_CAPTION | WS_MAXIMIZE
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0);
return TRUE;
}
This will start full screen on my development machine. But after
deploying it, it doesn't start in full screen on other machines.
Then I overrided the following method:
void CMainFrame::OnSetFocus(CWnd* /*pOldWnd*/)
{
// forward focus to the view window
m_wndView.SetFocus();
if (!m_bFullScreen)
{
m_bFullScreen = true;
int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
int cxFrame = ::GetSystemMetrics(SM_CXFRAME);
int cyFrame = ::GetSystemMetrics(SM_CYFRAME);
int cxScreen = ::GetSystemMetrics(SM_CXSCREEN);
int cyScreen = ::GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(NULL, -cxFrame, -(cyFrame + cyCaption), cxScreen + 2
* cxFrame, cyScreen + 2 * cyFrame + cyCaption, SWP_NOZORDER);
}
}
This will occupy most of the screen, but not the taskbar at the
bottom. How can I also let the application occupy really the full
screen (includeing the taskbar area)? Thanks.
Leo
Also take a look at
http://support.microsoft.com/kb/164162
-Seetharam
in CMyApp::InitInstance()
// The one and only window has been initialized, so show and update
it.
m_pMainWnd->ShowWindow(SW_MAXIMIZE); // start maximised
m_pMainWnd->UpdateWindow();
Paul
-Seetharam
> I have a CFrameWnd based SDI application. I want it to start in full
> screen.
Simply set CWinApp::m_nCmdShow to SW_MAXIMIZED!
--
Martin Richter [MVP] WWJD http://blog.m-ri.de
"A well-written program is its own heaven; a poorly written
program is its own hell!" The Tao of Programming
FAQ: http://www.mpdvc.de Samples: http://www.codeproject.com