大家看看我的代码,哪里有问题,如果错误太多的话,请重写一下!
void CMainFrame::SetFullScreenMode(bool bFullMode) // 全屏显示
{

int cxScreen = GetSystemMetrics(SM_CXSCREEN);
int cyScreen = GetSystemMetrics(SM_CYSCREEN); if((CConfig::m_RunMode == 2)|| (cxScreen <1024 && cyScreen<768))
{
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE);
style &= ~WS_CAPTION;
    ::SetWindowLong(m_hWnd,GWL_STYLE,style); style = ::GetWindowLong(m_hWnd,GWL_EXSTYLE);
style |= WS_EX_TOPMOST;
::SetWindowLong(m_hWnd,GWL_EXSTYLE,style);

SetWindowPos(&CWnd::wndTopMost,-2,-4,cxScreen+4,cyScreen+7,SWP_SHOWWINDOW);
}
else
{
SetWindowPos(NULL,cxScreen/2-400,cyScreen/2-350,800+GetSystemMetrics(SM_CXSIZEFRAME)*2+2,543+GetSystemMetrics(SM_CYSIZE) + GetSystemMetrics(SM_CYFRAME)+9,SWP_SHOWWINDOW);
}

}

解决方案 »

  1.   

    响应  WM_GETMINMAXINFO 
    void CMyDlgBase::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) 
    {

    CRect rcMax; 
    SystemParametersInfo(SPI_GETWORKAREA, NULL, (PVOID)&rcMax, 0); 
    lpMMI->ptMaxPosition.x = rcMax.left; 
    lpMMI->ptMaxPosition.y = rcMax.top; 
    lpMMI->ptMaxSize.x = rcMax.Width(); 
    lpMMI->ptMaxSize.y = rcMax.Height(); 
    lpMMI->ptMaxTrackSize.x = rcMax.Width(); 
    lpMMI->ptMaxTrackSize.y = rcMax.Height(); 
    CDialog::OnGetMinMaxInfo(lpMMI);
    }
      

  2.   

    你的else部分的代码反过来不就可以了void CMainFrame::SetFullScreenMode(BOOL bFullMode)
    {
    int cxScreen = GetSystemMetrics(SM_CXSCREEN);
    int cyScreen = GetSystemMetrics(SM_CYSCREEN);

    if(bFullMode)
    {
    LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE);
    style &= ~WS_CAPTION;
    ::SetWindowLong(m_hWnd,GWL_STYLE,style);

    style = ::GetWindowLong(m_hWnd,GWL_EXSTYLE);
    style |= WS_EX_TOPMOST;
    ::SetWindowLong(m_hWnd,GWL_EXSTYLE,style);

    SetWindowPos(&CWnd::wndTopMost,-2,-4,cxScreen+4,cyScreen+7,SWP_SHOWWINDOW);
    }
    else
    {
    LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE);
    style |= WS_CAPTION;
    ::SetWindowLong(m_hWnd,GWL_STYLE,style);

    style = ::GetWindowLong(m_hWnd,GWL_EXSTYLE);
    style &= ~WS_EX_TOPMOST;
    ::SetWindowLong(m_hWnd,GWL_EXSTYLE,style);
    SetWindowPos(NULL,cxScreen/2-400,cyScreen/2-350,800+GetSystemMetrics(SM_CXSIZEFRAME)*2+2,543+GetSystemMetrics(SM_CYSIZE) + GetSystemMetrics(SM_CYFRAME)+9,SWP_SHOWWINDOW);
    }
    }