void CChildFrame::OnSysCommand(UINT nID, LPARAM lParam) 
{
CWnd *ChildWnd;
CRect WndRect;
// TODO: Add your message handler code here and/or call default
if(nID==SC_MAXIMIZE)
{
ChildWnd=AfxGetMainWnd()->GetActiveWindow();
ChildWnd->GetClientRect(&WndRect);
//ChildWnd->SetWindowPos(ChildWnd,WndRect.top,WndRect.right,WndRect.left,WndRect.bottom,SWP_NOMOVE);
ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,
SWP_NOMOVE|SWP_DRAWFRAME); }
//CMDIChildWnd::OnSysCommand(nID, lParam);
}

解决方案 »

  1.   

    ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,SWP_NOMOVE|SWP_DRAWFRAME);
    第一个参数是NULL?
      

  2.   

    ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,SWP_NOMOVE|SWP_DRAWFRAME);
    第一个参数是NULL?
    NULL 替换成 ChildWnd、AfxGetMainWnd()都不行呀!!!第一个参数到底有什么用呀!!
      

  3.   

    NULL指定一个参数,不一定是Cwnd,可以是:&wndBottom,&wndTop...详细可以查下MSDN
      

  4.   

    在子框架窗口中重载ActivateFrame函数void CChiFrame::ActivateFrame(int nCmdShow) 
    {
    // TODO: Add your specialized code here and/or call the base class nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
    }
      

  5.   

    在子框架窗口中重载ActivateFrame函数void CChiFrame::ActivateFrame(int nCmdShow)
    {
    // TODO: Add your specialized code here and/or call the base classnCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
    }我并不是要求,初始子窗口时最大化。而是想要达到  当我点击 子窗口最大化按钮时,子窗口的大小变成 200*200,我已经
    BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
     cs.cx=100;
     cs.cy=100;
     
     if( !CMDIChildWnd::PreCreateWindow(cs) )
    return FALSE; return TRUE;
    }
      

  6.   

    严重同意夏娃滴诱惑第一个参数:
    pWndInsertAfter 
    Identifies the CWnd object that will precede this CWnd object in the Z-order. This parameter can be a pointer to a CWnd or a Pointer to one of the following values: 
    wndBottom   Places the window at the bottom of the Z-order. If this CWnd is a topmost window, the window loses its topmost status; the system places the window at the bottom of all other windows. 
    wndTop   Places the window at the top of the Z-order. 
    wndTopMost   Places the window above all nontopmost windows. The window maintains its topmost position even when it is deactivated. 
    wndNoTopMost   Repositions the window to the top of all nontopmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a nontopmost window. 
    ChildWnd->SetWindowPos( &(childWnd->wndTop), 0, 0, 200, 200,
    SWP_NOMOVE|SWP_DRAWFRAME);ChildWnd->SetWindowPos(NULL, 这样试试
      

  7.   

    BOOL SetWindowPlacement(          HWND hWnd,
        WINDOWPLACEMENT *lpwndpl
    );
      

  8.   

    我已经找问题的原因了,问题出在ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,
    SWP_NOMOVE|SWP_DRAWFRAME);其实不用去求 ChildWnd,用this就可以了。谢谢各位了。