SendMessage的返回值是什么?
如题。 问题点数:10、回复次数:6Top
1 楼titilima(李马 - www.titilima.cn)回复于 2004-02-02 18:17:38 得分 0
根据具体消息的不同,SendMessage的返回值也是不同的,具体消息及相应的返回值可以查阅MSDN。Top
2 楼lzzqqq(Jonersen)回复于 2004-02-02 18:19:13 得分 0
一个四字节的值,
对不同的消息可以解释成不同的意义。
比如一个DWORD数值,或某种数据类型的指针。
很少有用SendMessage返回值的情况。Top
3 楼zhuyie()回复于 2004-02-02 18:24:45 得分 0
就是响应该消息的处理函数的返回值Top
4 楼yangl79(杨)回复于 2004-02-02 18:25:40 得分 0
我就见过用SendMessage发送BM_GETCHECK给RADIOBUTTON检查是否选中某项。Top
5 楼titilima(李马 - www.titilima.cn)回复于 2004-02-02 20:29:20 得分 10
BM_GETCHECK Message
--------------------------------------------------------------------------------
An application sends a BM_GETCHECK message to retrieve the check state of a radio button or check box.
Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) BM_GETCHECK, // message ID
(WPARAM) wParam, // = 0; not used, must be zero
(LPARAM) lParam // = 0; not used, must be zero
);
Parameters
wParam
Not used; must be zero.
lParam
Not used; must be zero.
Return Value
The return value from a button created with the BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or BS_3STATE style can be one of the following.
BST_CHECKED Button is checked.
BST_INDETERMINATE Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
BST_UNCHECKED Button is cleared
以上就是MSDN中关于BM_GETCHECK的解释,如你所见,在这里SendMessage的返回值就是这个Radio或CheckBox的选中情况,但是对于LB_GETCOUNT消息而言,它的返回值就是ListBox的列表项总数了:
LB_GETCOUNT Message
--------------------------------------------------------------------------------
An application sends an LB_GETCOUNT message to retrieve the number of items in a list box.
Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) LB_GETCOUNT, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = (LPARAM) () lParam;
);
Parameters
wParam
Not used; must be zero.
lParam
Not used; must be zero.
Return Value
The return value is the number of items in the list box, or LB_ERR if an error occurs.
Remarks
The returned count is one greater than the index value of the last item (the index is zero-based).Top
6 楼yangl79(杨)回复于 2004-02-02 21:06:28 得分 0
我的MSDN是两张盘,好多东西里面都没有,当然真该卖三张的。Top




