1.Set FullScreen Function
void CMainFrame::OnFullScreen()
{
GetWindowPlacement(&m_OldWndpl);
CRect WindowRect,ClientRect;
GetWindowRect(&WindowRect);
RepositionBars(0,0xffff,AFX_IDW_PANE_FIRST,reposQuery,&ClientRect);
ClientToScreen(&ClientRect;
int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
int nFullHeight=GetSystemMetrics(M_CYSCREEN);
m_FullScreenRect.left=WindowRect.left-ClientRect.left;
m_FullScreenRect.top=WindowRect.top-ClientRect.top;
m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight;
m_bFullScreen=TRUE;
WINDOWPLACEMENT wndpl;
wndpl.length=sizeof(WINDOWPLACEMENT);
wndpl.flags=0;
wndpl.showCmd=WS_SHOWNORMAL;
wndpl.rcNormalPosition=m_FullScreenRect;
SetWindowPlacement(&wndpl);
}
2.
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMi)
{
if(m_bFullScreen)
{
lpMMi->ptMaxSize.x=m_FullScreenRect.Width();
lpMMi->ptMaxSize.y=m_FullScreenRect.Height();
lpMMi->ptMaxPosition.x=m_FullScreenRect.left;
lpMMi->ptMaxPosition.y=m_FullScreenRect.top;
lpMMi->ptMaxTrackSize.x=m_FullScreenRect.Width();
lpMMi->ptMaxTrackSize.y=m_FullScreenRect.Height();
}
CFrameWnd::OnGetMinMaxInfo(lpMMi);
}
3.
void CMainFrame::OnEndFullScreen()
{
if(m_bFullScreen)
{
m_bFullScreen=FALSE;
ShowWindow(SW_HIDE);
SetWindowPlacement(&m_OldWndpl);
}
}4.
SystemParametersInfo(97,false,NULL,0)可把CTRL+ALT+DEL锁住,用SystemParametersInfo(97,true,NULL,0)解开。
5.
最后退出Windows
Call:ExitWindowsEx(1,1)//只用于Win9.x,如为WinNT or Win2000,请自行查找MSDN 中ExitWindowsEx的参数