你需要响应该按钮的:UPDATE_COMMAND_UI消息,
在VIEW、DOC、FRAME中都可以! 

解决方案 »

  1.   

    文章:(msdn)CDialogBar Button Enabled When Command Handler Present
        
      从该文章可知:
    A button in a CDialogBar object is disabled automatically if the command routing does not contain a command handler function for the button. To enable a button in a CDialogBar object, the command routing must include a command handler for the button. A button command handler can be an ON_BN_CLICKED(), ON_COMMAND(), or ON_COMMAND_UI() message handler and it must appear in the message map of an object in the command routing. If the parent of the CDialogBar object is a CFrameWnd object, then the command is handled by the active child window or view, by the document attached to the view, by the frame window, and by the application (CWinApp object). Note that because the CDialogBar object is not included in the routing scheme, the ON_BN_CLICKED() or ON_COMMAND() handler must be placed in one of the objects mentioned above that is in the routing scheme and not in the CDialogBar class. 所以,在主框架类里添加接收按钮click消息,但是处理该事件在CDialogBar类里。
      

  2.   

    文章:(msdn)CDialogBar Button Enabled When Command Handler Present
        
      从该文章可知:
    A button in a CDialogBar object is disabled automatically if the command routing does not contain a command handler function for the button. To enable a button in a CDialogBar object, the command routing must include a command handler for the button. A button command handler can be an ON_BN_CLICKED(), ON_COMMAND(), or ON_COMMAND_UI() message handler and it must appear in the message map of an object in the command routing. If the parent of the CDialogBar object is a CFrameWnd object, then the command is handled by the active child window or view, by the document attached to the view, by the frame window, and by the application (CWinApp object). Note that because the CDialogBar object is not included in the routing scheme, the ON_BN_CLICKED() or ON_COMMAND() handler must be placed in one of the objects mentioned above that is in the routing scheme and not in the CDialogBar class. 所以,在主框架类里添加接收按钮click消息,但是处理该事件在CDialogBar类里。