CRect ClientRect; pChild->GetClientRect(&ClientRect); ClientToScreen(&ClientRect); int screenx=GetSystemMetrics(SM_CXSCREEN); int screeny=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(NULL,-4,-4,screenx+8,screeny+8,SWP_NOZORDER); RecalcLayout(); m_bFullScreen=true; }else { if ( m_bFullScreen ) { LONG style=::GetWindowLong(m_hWnd,GWL_STYLE); style|=WS_CAPTION; ::SetWindowLong(m_hWnd,GWL_STYLE,style);
{
CMDIChildWnd* pChild=MDIGetActive(); if(!pChild) return;
GetWindowRect(&m_mainRect);
m_bToolBarVisible=(m_wndToolBar.IsWindowVisible()!=0);
m_wndToolBar.ShowWindow(SW_HIDE);
m_bStatusBarVisible=(m_wndStatusBar.IsWindowVisible()!=0);
m_wndStatusBar.ShowWindow(SW_HIDE);
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE); style &= ~WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style); style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);
m_bChildMax=(style & WS_MAXIMIZE)?true:false;
pChild->ShowWindow(SW_SHOWMAXIMIZED);
CRect ClientRect; pChild->GetClientRect(&ClientRect); ClientToScreen(&ClientRect);
int screenx=GetSystemMetrics(SM_CXSCREEN);
int screeny=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(NULL,-4,-4,screenx+8,screeny+8,SWP_NOZORDER);
RecalcLayout();
m_bFullScreen=true;
}else
{
if ( m_bFullScreen )
{
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE); style|=WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
if(m_bToolBarVisible) m_wndToolBar.ShowWindow(SW_SHOW);
if(m_bStatusBarVisible) m_wndStatusBar.ShowWindow(SW_SHOW);
MoveWindow(&m_mainRect);
RecalcLayout();
CMDIChildWnd* pChild=MDIGetActive();
if(pChild){ if(m_bChildMax) MDIMaximize(pChild); else MDIRestore(pChild); }
m_bFullScreen=false;
}
}
PostMessage(WM_SYSCOMMAND,SC_MAXIMIZE,0);
aat_ydt()
什么时候调用你给我这些代码?其实,用菜单命令 实现全屏我已经找到相应的程序了。只是不知道如何一起动就实现全屏状态。那些菜单栏,标题栏都不显示。MFC向导生成的程序都是先显示一个窗口! 我不知道什么时候调用这个全屏的代码。而且,我根据那个程序更改的程序实现的全屏是不稳定的。
int cx = GetDeviceCaps( hdcScreen, HORZRES );
int cy = GetDeviceCaps( hdcScreen, VERTRES );
DeleteObject( hdcScreen );SetMenu( ghWnd, NULL );
SetWindowLong( ghWnd, GWL_STYLE, WS_POPUP | WS_VISIBLE );
SetWindowPos( ghWnd, HWND_TOP, 0, 0, cx, cy, SWP_NOACTIVATE );
if( ghwndToolbar )
ShowWindow( ghwndToolbar, SW_HIDE );
if( ghwndTrackbar )
ShowWindow( ghwndTrackbar, SW_HIDE );
if( ghwndStatusbar )
ShowWindow( ghwndStatusbar, SW_HIDE );
ShowCursor( FALSE );