我想在窗口最小化时做一些处理,如何做

解决方案 »

  1.   

    BOOL IsIconic( ) const;
    Specifies whether CWnd is minimized (iconic).
      

  2.   

    OnSize ( 
    UINT nType, 
    int cx, 
    int cy ); 
    判断nType
    nType 
    Specifies the type of resizing requested. This parameter can be one of the following values: 
    SIZE_MAXIMIZED   Window has been maximized. 
    SIZE_MINIMIZED   Window has been minimized. 
    SIZE_RESTORED   Window has been resized, but neither SIZE_MINIMIZED nor SIZE_MAXIMIZED applies. 
    SIZE_MAXHIDE   Message is sent to all pop-up windows when some other window is maximized. 
    SIZE_MAXSHOW   Message is sent to all pop-up windows when some other window has been restored to its former size. 
      

  3.   

    在mainframe.cpp中加入
    void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
    {
      if (nID == SC_MINIMIZE)
      {
        // Do something
      }
      else
        CFrameWnd::OnSysCommand(nID, lParam);
    }
    就行了。