我现在做一个MDI的程序,程序开始的时候生成的第一个窗口,我要把它一直处于最大化状态,我用
MDIMaximize()这个函数做到了,但是当生成第二个窗口的时候也是最大化,当我把第二个最小时候,
第一个也变小了,我怎么控制都不能控制第一个,使它始终最大化,那位知道怎么控制?

解决方案 »

  1.   

    在第一个窗口的处理一下WM_SYSCOMMAND 消息当第二个窗口向第一个窗口发出最小化消息时
    第一个窗口WM_SYSCOMMAND 接收SC_MINIMIZE 参数
    void CQQDlg::OnSysCommand(UINT nID, LPARAM lParam)
    { if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
    }
    if(nID==SC_MINIMIZE)
    {
    //在这里处理一下 }
    else
    {
    CDialog::OnSysCommand(nID, lParam);
    }
    }你处理一下
      

  2.   

    刚才写错了一点
    if((nID & 0xFFF0)==SC_MINIMIZE)//低4位是windows内部使用的,所以要与0xFFF0相与
    {
    //在这里处理一下
         }
      

  3.   

    NET_00K(dsj) 你好,你说的方法不行呀,因为MDI,我创建了多个视图,他们都是来自于同一个
    CMDIChildWnd,OnSysCommand只能加在这里面,你怎么区分是第2个给第一个的消息
      

  4.   

    RECT DesktopRect;
        WINDOWPLACEMENT WPNew; m_FullScreen = m_FullScreen ? TRUE : FALSE;    if(!m_FullScreen)
        {        // need to hide all status bars
            m_wndStatusBar.ShowWindow(SW_HIDE);
        m_wndToolBar.ShowWindow(SW_HIDE);
            //Adjust RECT to new size of window
        ::GetWindowRect(::GetDesktopWindow(), &DesktopRect);
         m_wndSplitter.GetPane(0,0)->ShowWindow(SW_HIDE);
    m_wndSplitter2.GetPane(1,0)->ShowWindow(SW_HIDE);
    m_wndSplitter.GetColumnInfo(0,x,x1);
    m_wndSplitter2.GetRowInfo(0,y,y1);
    CRect tabrect;
    CPeerOperatorTabCtrl *tabctrl;
    tabctrl=(CPeerOperatorTabCtrl *)m_wndSplitter2.GetPane(0,0);
    tabctrl->GetItemRect(0,&tabrect);
        // We'll need these to restore the original state.
        GetWindowPlacement (&m_WPPrev);
    m_wndSplitter.SetColumnInfo( 0,0,0);
    m_wndSplitter2.SetRowInfo( 0,DesktopRect.bottom-DesktopRect.top+tabrect.Height()+44,0);     m_WPPrev.length = sizeof m_WPPrev; DesktopRect.left -= 1+16;
    DesktopRect.top -= tabrect.Height()+44;
    DesktopRect.bottom += 2+16;
    DesktopRect.right += 2+8;     ::AdjustWindowRectEx(&DesktopRect, GetStyle(), TRUE, GetExStyle());     // Remember this for OnGetMinMaxInfo()
        m_FullScreenWindowRect = DesktopRect;
            
            WPNew = m_WPPrev;
            WPNew.showCmd =  SW_SHOWNORMAL;
        WPNew.rcNormalPosition = DesktopRect;
        
    //        m_pWndFullScreenBar=new CToolBar;
    //
    //        if(!m_pWndFullScreenBar->Create(this,CBRS_SIZE_DYNAMIC|CBRS_FLOATING) ||
    //        !m_pWndFullScreenBar->LoadToolBar(IDR_SCREEN_FULL))
    //     {
    //      TRACE0("Failed to create toolbar\n");
    // return; // fail to create
    //         }
    //        
    //        //don't allow the toolbar to dock
    // m_pWndFullScreenBar->ModifyStyle(WS_CAPTION,0);
    //        m_pWndFullScreenBar->EnableDocking(0);
    // m_pWndFullScreenBar->SetWindowPos(0, 0,0, 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
    // m_pWndFullScreenBar->SetWindowText(_T("Hold Ctrl+F to switch between normal and a full screen"));
    // FloatControlBar(m_pWndFullScreenBar, CPoint(0,0));
    // m_pWndFullScreenBar->EnableToolTips(TRUE);
    m_FullScreen=TRUE;
        }
        else
        {
    //        m_pWndFullScreenBar->DestroyWindow();
    // delete m_pWndFullScreenBar;        m_FullScreen=FALSE;        m_wndStatusBar.ShowWindow(SW_SHOWNORMAL);
        m_wndToolBar.ShowWindow(SW_SHOWNORMAL);
         m_wndSplitter.GetPane(0,0)->ShowWindow(SW_SHOWNORMAL);
    m_wndSplitter2.GetPane(1,0)->ShowWindow(SW_SHOWNORMAL);
    m_wndSplitter.SetColumnInfo(0,x,x1);
    m_wndSplitter2.SetRowInfo( 0,y,y1);
            WPNew = m_WPPrev;
        }
        
        SetWindowPlacement(&WPNew);