关于 SendMessage 发送 TB_GETSTATE 的问题

dinojy2011 2011-09-26 04:28:43
在一外部窗体,有一个ToolBar控件,请问我应该如何知道它第一个按钮的state 值,因为我想知道它是否被点击了


void Main()
{
long lng1 = 123456 ; // 123456 就是那个toolbar 控件句柄
HWND hwnd1 = (HWND) lng1 ;
LERESULT lr1 = sendMessage(hwnd1,TB_GETSTATE,1,0 ); // 返回的值是state值的集合
if ( lr1 & IS_CHECKED ) == IS_CHECKED ) // 在线的MSDN查不到 是否被勾选的值,临时用IS_CHECKED 替换
{
cout<<"第一个按钮被勾选"<<endl;
}
}
PS:1我的目的是获取 其他窗体上面Toolbar 控件 的第一个按钮的STATE,是其他窗体上的,不是自己程序里面的ToolBar控件的state 值
2 下面的是 TB_GETSTATE 的帮助
TB_GETSTATE
Send Feedback
This message retrieves information about the state of the specified button in a toolbar, such as whether it is enabled, pressed, or checked.

TB_GETSTATE wParam = (WPARAM) idButton; lParam = 0;Parameters
idButton
Command identifier of the button for which to retrieve information.
lParam
Not used.
Return Values
The button state information indicates success. –1 indicates failure. The button state information can be a combination of values. For information about toolbar button state values, see Toolbar Controls Notifications.

Requirements
OS Versions: Windows CE 1.0 and later.
Header: Commctrl.h.

...全文
109 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
就想叫yoko 2011-09-26
  • 打赏
  • 举报
回复
帮顶。

64,683

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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