询问者
基于MFC的Activex控件,在其继承自COleControl的类里边怎样能处理ON_UPDATE_COMMAND_UI消息

问题
全部回复
-
ActiveX没有自己的消息循环,所以ON_UPDATE_COMMAND_UI没用。
你可以定时广播WM_IDLEUPDATECMDUI到所有子窗口
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP -
ActiveX没有自己的消息循环,所以ON_UPDATE_COMMAND_UI没用。
你可以定时广播WM_IDLEUPDATECMDUI到所有子窗口
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
谢谢:)我试着CMyActivXCtrl类里设置了一个定时器,在定时器内用SendMessageToDescendants函数广播WM_IDLEUPDATECMDUI消息,然后添加工具栏按钮对ON_UPDATE_COMMAND_UI的消息映射,设置断点后函数没有进去。不知道是不是其中哪步设置有问题。
目前是在CMyActivXCtrl类里设置一个定时器,在定时器里边执行m_wndToolBar.OnUpdateCmdUI(this, FALSE);然后再CMyActivXCtrl类里添加对按钮的ON_UPDATE_COMMAND_UI消息映射,可以动态更新状态。
不知道是否有更好的方法。
-
你如果知道工具栏按钮状态在什么时候变化的话,可以不用定时器,直接在变化的时候调用UpdateDialogControls。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已编辑 Sheng Jiang 蒋晟Moderator 2011年11月7日 17:45
-
你如果知道工具栏按钮状态在什么时候变化的话,可以不用定时器,直接在变化的时候调用UpdateDialogControls。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
我试了下,不管用了。
请问是调用该函数后,程序会去执行与ON_UPDATE_COMMAND_UI映射的函数吗?
我现在是在CMyActivXCtrl类里边添加对ON_UPDATE_COMMAND_UI的消息映射。