如何取消标题栏,只保留工具栏?
在MFC 7.0里面
自动生成的单文档框架里面?

解决方案 »

  1.   

    显示和隐藏标题栏方法一:使用API实现 
    //隐藏TitleBar
    LONG lStyle = ::GetWindowLong(this->m_hWnd, GWL_STYLE);
    ::SetWindowLong(this->m_hWnd, GWL_STYLE, lStyle & ~WS_CAPTION);
    ::SetWindowPos(this->m_hWnd, NULL, 0, 0, 0, 0,
    SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);// 显示TitleBar
    ::SetWindowLong(this->m_hWnd, GWL_STYLE, lStyle | WS_CAPTION);
    ::SetWindowPos(this->m_hWnd, NULL, 0, 0, 0, 0,??SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);方法二:使用CWnd成员函数ModifyStyle实现
    // 隐藏TitleBar
    ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED);
    // 显示TitleBar
    ModifyStyle(0, WS_CAPTION, SWP_FRAMECHANGED);