WM_IDLEUPDATECMDUI WM_KICKIDLE的含义??

aguo2006 2007-01-22 12:56:32
ExaTBar_1 是 CToolBar的派生类
在ExaTBar_1.CPP 中消息映射为

BEGIN_MESSAGE_MAP(ExaTBar_1,CToolBar)

//{{ AFX_MSG_MAP(ExaTBar_1)
ON_MESSAGE(WM_IDLEUPDATECMDUI,OnIdleUpdateCmdUI)
//}} AFX_MSG_MAP

END_MESSAGE_MAP()



ExaDg_1 是 CDialog)的派生类
在ExaDg_1.cpp 中消息映射为

BEGIN_MESSAGE_MAP(ExaDg_1, CDialog)
//{{AFX_MSG_MAP(ExaDg_1)
ON_MESSAGE_VOID(WM_KICKIDLE,OnKickIdle)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

void ExaDg_1::OnKickIdle()
{
SendMessageToDescendants(WM_IDLEUPDATECMDUI);
}

ExaTBar_1 是 ExaDg_1上的一个TOOLBAR ;我的问题的是

WM_IDLEUPDATECMDUI 是什么含义?
WM_KICKIDLE 是什么含义?

结合本段代码 它们之间的关系?
...全文
477 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
王国凡 2007-01-24
  • 打赏
  • 举报
回复
查了一下 MSDN :

WM_IDLEUPDATECMDUI
This message is sent in idle time to implement the idle-time update of update-command UI handlers. If the window (usually a control bar) handles the message, it creates a CCmdUI object (or an object of a derived class) and call CCmdUI::DoUpdate for each of the "items" in the window. This will in turn check for an ON_UPDATE_COMMAND_UI handler for the objects in the command-handler chain.

WM_INITIALUPDATE
This message is sent by the document template to all descendants of a frame window when it is safe for them to do their initial update. It maps to a call to CView::OnInitialUpdate but can be used in other CWnd-derived classes for other one-shot updating.
syy64 2007-01-24
  • 打赏
  • 举报
回复
CControlBar::OnUpdateCmdUI
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ) = 0;

Parameters

pTarget

Points to the main frame window of the application. This pointer is used for routing update messages.

bDisableIfNoHndler

Flag that indicates whether a control that has no update handler should be automatically displayed as disabled.

Remarks

This member function is called by the framework to update the status of the toolbar or status bar.

To update an individual button or pane, use the ON_UPDATE_COMMAND_UI macro in your message map to set an update handler appropriately. See ON_UPDATE_COMMAND_UI for more information about using this macro.

OnUpdateCmdUI is called by the framework when the application is idle. The frame window to be updated must be a child window, at least indirectly, of a visible frame window. OnUpdateCmdUI is an advanced overridable.

CControlBar Overview | Class Members | Hierarchy Chart

See Also ON_UPDATE_COMMAND_UI, Technical Note 31: Control Bars
aguo2006 2007-01-24
  • 打赏
  • 举报
回复
LRESULT ExaTBar_2::OnIdleUpdateCmdUI(WPARAM wParam,LPARAM)
{
CToolBar::OnIdleUpdateCmdUI(wParam,0);

if(IsWindowVisible())
{
CFrameWnd * pParent = (CFrameWnd*)GetParent();
if(pParent)
OnUpdateCmdUI(pParent,(BOOL)wParam);
}

return 0L;
}
aguo2006 2007-01-24
  • 打赏
  • 举报
回复

TO :SYY64

#define WM_IDLEUPDATECMDUI 0x0363 // wParam == bDisableIfNoHandler
#define WM_INITIALUPDATE 0x0364 // (params unused) - sent to children

在 afxpriv.h 里面怎么有定义呢?
syy64 2007-01-24
  • 打赏
  • 举报
回复
WM_IDLEUPDATECMDUI, WM_KICKIDLE读是自定义消息吧,从代码中看不出什么,字面理解是跟空处理有关。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧