statusbar 显示 toolbar的text

小呆呆呆 2011-09-27 11:09:58
我现在有个程序,当我鼠标移动到tool bar上面时候,status bar的text改为tool bar的text.

ON_UPDATE_COMMAND_UI (ID_INDICATOR_TIME, OnUpdateTime)
上面的函数我也没找到, 请问是如何做到的?
...全文
87 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Eleven 2011-09-27
  • 打赏
  • 举报
回复
主要都是框架类的功劳,F11进入CFrameWnd类的
WM_SETMESSAGESTRING消息响应函数

LRESULT CFrameWnd::OnSetMessageString(WPARAM wParam, LPARAM lParam)
{
UINT nIDLast = m_nIDLastMessage;
m_nFlags &= ~WF_NOPOPMSG;

CWnd* pMessageBar = GetMessageBar();
if (pMessageBar != NULL)
{
LPCTSTR lpsz = NULL;
CString strMessage;

// set the message bar text
if (lParam != 0)
{
ASSERT(wParam == 0); // can't have both an ID and a string
lpsz = (LPCTSTR)lParam; // set an explicit string
}
else if (wParam != 0)
{
// map SC_CLOSE to PREVIEW_CLOSE when in print preview mode
if (wParam == AFX_IDS_SCCLOSE && m_lpfnCloseProc != NULL)
wParam = AFX_IDS_PREVIEW_CLOSE;

// get message associated with the ID indicated by wParam
GetMessageString(wParam, strMessage);
lpsz = strMessage;
}
pMessageBar->SetWindowText(lpsz);

// update owner of the bar in terms of last message selected
CFrameWnd* pFrameWnd = pMessageBar->GetParentFrame();
if (pFrameWnd != NULL)
{
pFrameWnd->m_nIDLastMessage = (UINT)wParam;
pFrameWnd->m_nIDTracking = (UINT)wParam;
}
}

m_nIDLastMessage = (UINT)wParam; // new ID (or 0)
m_nIDTracking = (UINT)wParam; // so F1 on toolbar buttons work
return nIDLast;
}
小呆呆呆 2011-09-27
  • 打赏
  • 举报
回复
xiexie ni
古都一猿 2011-09-27
  • 打赏
  • 举报
回复
不是这样子的 你打开你的工程到资源里找到工具条 比如工具条的ID是ID_TOOLBAR1,打开它的属性下面不是有个“提示”嘛,输入“工具条\n工具条” “\n”前面的部分是你鼠标放到工具条按钮上显示的内容,后面就是你状态栏显示的内容啦

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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