描述:
我在ActiveX中创建一个FrameWnd作为控件的child,再为FrameWnd创建一个ToolBar和View。
这样做主要是为了使用ToolBar,StatusBar什么的方便,各项功能都挺好的,可是有一个小问题,就是ToolBar的上的按钮获得不了ON_UPDATE_COMMAND_UI消息,在FrameWnd中截获不到,View中也截获不到,也就是说我没法改变按钮的Enable状态
挺头痛的,请各位帮忙
解决方案1:
不可能
解决方案2: http://www.microsoft.com/mind/0497/mfc.asp
void CActiveXDocControl::OnTimer(UINT nIDEvent)
{
// Since we're in an OCX, we don't control the message loop,
// so CWinThread::OnIdle is never called. That means we have
// to periodically pump the ON_UPDATE_COMMAND_UI messages
// by hand.
SendMessageToDescendants(WM_IDLEUPDATECMDUI, TRUE);
COleControl::OnTimer(nIDEvent);
}
BEGIN_MSG_MAP(CMdiAx)
CHAIN_MSG_MAP(CComControl_Test<CMdiAx>)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
{
CComControl_Test<CMdiAx>::PreTranslateMessage(pMsg);
return S_OK;
}
请确定 ax 是否把消息都路由给了 FrameWnd
要看看程序才知道啊。没这么做过。不好说。
解决方案6: 用类向导添加
不起作用吗?