轻问:
   
    在MDI工程中,怎样让程序的主窗口在一开始运行时就最大化?    在SDI中又该如何做呢?

解决方案 »

  1.   

    在APP类的InitInstance()函数中
    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);//程序界面最大化显示
    m_pMainWnd->UpdateWindow();
      

  2.   

    在MDI工程中,是子窗口最大化:
    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;
    cs.style &= ~WS_SYSMENU;//去除系统菜单
    cs.style |= WS_MAXIMIZE;
    return TRUE;
    }
      

  3.   

    很容易阿。只要在应用程序类的InitInstance函数的return true前的那句 m_pMainWnd->ShowWindow(***);改为 m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
    就可以了。SDI和MDI都是一样的
      

  4.   

    在MDI工程中,使子窗口最大化:重载ActivateFrame
    void CChildFrame::ActivateFrame(int nCmdShow) 
    {
    // TODO: Add your specialized code here and/or call the base class
    nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
    // ModifyStyleEx(WS_MAXIMIZEBOX,0,SWP_DRAWFRAME);
    // ModifyStyleEx(WS_MINIMIZEBOX,0,SWP_DRAWFRAME);
    }