多文档程序启动后子窗口(非主窗口)处于最大化,要使子窗口最小化和恢复按钮无效。这个问题至今还没有人能正确解答。

解决方案 »

  1.   

    应该是在窗口创建的时候设置窗口属性吧
    将WS_MINIMIZEBOX属性屏蔽就行了贝
      

  2.   

    VB中的解决代码,希望对你有帮助
    Rem 以下几个API及其常量声明为了屏蔽窗体关闭按钮
    Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
    Public Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    Public Const MF_BYPOSITION = &H400&
    Public Const MF_REMOVE = &H1000&
    Public Const SC_CLOSE = &HF060&Public Function ShieldWindowCloseButton(frm As Form) As Boolean
    Dim hSysMenu As Long
    Dim n As Long
    hSysMenu = GetSystemMenu(frm.hwnd, Flase)
    If hSysMenu Then
        n = GetMenuItemCount(hSysMenu)
        If n Then
            RemoveMenu hSysMenu, n - 1, MF_BYPOSITION Or MF_REMOVE
            RemoveMenu hSysMenu, n - 2, MF_BYPOSITION Or MF_REMOVE
            DrawMenuBar frm.hwnd
            ShieldWindowCloseButton = True
        End If
    End If
    ShieldWindowCloseButton = False
    End Function
      

  3.   

    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs if( !CMDIChildWnd::PreCreateWindow(cs) )
    return FALSE;
             cs.style &= ~WS_MAXIMIZEBOX;//加上
             cs.style &= ~WS_MINIMIZEBOX   
    }
      

  4.   

    费了九牛二虎之力终于让我找的解决办法了!
    楼主你应该将帖子加分!
    因为现在都凌晨1:20-----〉全是被你的问题搞得!明天还有上班呀!
    嘿嘿!
    [email protected]
    ---------------------------------
    //make the child frame window maximize,so the view maximize!
    void CMDI_TestView::OnInitialUpdate() 
    {
    CView::OnInitialUpdate(); CFrameWnd *pFrame=NULL;
    pFrame=this->GetParentFrame();
    if(pFrame)
    {
      pFrame->ShowWindow(SW_MAXIMIZE );
    }
    // TODO: Add your specialized code here and/or call the base class

    }添加消息:WM_SYSCOMMAND
    //mask the systemcommand message!
    void CChildFrame::OnSysCommand(UINT nID, LPARAM lParam) 
    {
    // TODO: Add your message handler code here and/or call default
      //mask the system message :maximize button,minimize button 
      //and restore button!
    if(SC_MAXIMIZE==nID||SC_RESTORE==nID||SC_MINIMIZE==nID)
      return;
    CMDIChildWnd::OnSysCommand(nID, lParam);
    }
      

  5.   

    那个子窗口是View创建的,从View着手