关于 SendMessage 发送 TB_GETSTATE 的问题
在一外部窗体,有一个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.