加入afx_msg void OnSysCommand(UINT nID,LPARAM lParam)
然后自己手动加入消息映射ON_WM_SYSCOMMAND()
在onsyscommand就是捕捉到的消息的处理了,
不过一定要记得在最后加上cwnd::onsycommand(nid,lparam),

解决方案 »

  1.   

    In the .h file , add :afx_msg void OnSysCommand( UINT nID, LPARAM lParam ); 
    In the .cpp file, add the OnSysCommand message map macro: ON_WM_SYSCOMMAND() Override OnSysCommand of the frame window class that you are using for the formview, and send the WM_SAVEFOCUS message when it is about to minimize. The code should resemble the following: void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
    {
            if ((nID & 0xfff0) == SC_MINIMIZE)
                    GetActiveView()->SendMessage(WM_SAVEFOCUS);        CFrameWnd::OnSysCommand(nID,lParam);
      

  2.   

    还是不行~
    povety(wood) 和cvip11(cvip11) 
    的方法最后的错误消息都是
    MainFrm.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CMainFrame::OnCommand(unsigned int,long)" (?OnCommand@CMainFrame@@MAEHIJ@Z)
    Debug/PantoDrw.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
      

  3.   

    可不可能是我的系统问题呢?
    我重载了一个MyFrame类,直接继承CWnd,用CLASSWIAZD捕获到了WM_SYSCOMMAND消息
    然而它依旧说我是:
    MainFrm.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CMainFrame::OnCommand(unsigned int,long)" (?OnCommand@CMainFrame@@MAEHIJ@Z)
    Debug/PantoDrw.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.好奇怪啊!