怎么实现当窗口正常的情况下有最小化、最大化和关闭,而当窗口最大化时就没有标题栏了,就像暴风影音那种效果。推出最大化就又出现了最小化、最大化和关闭标题栏。请高手帮帮忙

解决方案 »

  1.   

    void CDEMODlg::OnSize(UINT nType, int cx, int cy)
    {
    CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here
    if(IsZoomed())
    {
    //AfxMessageBox(_T("MAX"));
    LONG lStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
    lStyle &= ~WS_CAPTION;
    //lStyle &= ~WS_THICKFRAME;
    SetWindowLong(GetSafeHwnd(), GWL_STYLE, lStyle);
    SetWindowPos(NULL, 0, 0, 0, 0,      
    SWP_NOSIZE |SWP_NOMOVE |SWP_NOZORDER |SWP_NOACTIVATE|SWP_FRAMECHANGED);  
    }
    else
    { }
    }
      

  2.   

    或者:
    ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED); 
      

  3.   

    这个可以全屏~
    LONG style = ::GetWindowLong(this->m_hWnd,GWL_STYLE);
    style &= ~(WS_DLGFRAME | WS_THICKFRAME);
    SetWindowLong(this->m_hWnd,GWL_STYLE, style);
    this->ShowWindow(SW_SHOWMAXIMIZED);
    CRect rect;
    this->GetWindowRect(&rect);
    ::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left+1, rect.top+1, rect.right-rect.left-2, rect.bottom-rect.top-2, SWP_FRAMECHANGED);
      

  4.   

    SetWindowPos(&wndTopMost,....);设置到顶层窗口试试
      

  5.   

    窗口最大化:
    GetWindowRect(m_rect); // m_rect定义为类的成员变量,保存最大化前窗口区域 CRect rectDesktop;
    ::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop );
    LONG lStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
    lStyle &= ~WS_CAPTION;
    //lStyle &= ~WS_THICKFRAME;
    SetWindowLong(GetSafeHwnd(), GWL_STYLE, lStyle);
    SetWindowPos(NULL, 0, 0, rectDesktop.Width(), rectDesktop.Height(),
    SWP_SHOWWINDOW|SWP_FRAMECHANGED); 
    ------------------------------------------------------------------------------窗口还原:
    LONG lStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
    lStyle |= WS_CAPTION; SetWindowLong(GetSafeHwnd(), GWL_STYLE, lStyle);

    SetWindowPos(NULL, m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
    SWP_SHOWWINDOW|SWP_FRAMECHANGED); 
      

  6.   

    谢谢 VisualEleven,很热心,感动!也很感谢其他人,谢谢了。