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 ); ParameterswParam Not used; must be zero. lParam Not used; must be zero. Return ValueThe 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; ); ParameterswParam Not used; must be zero. lParam Not used; must be zero. Return ValueThe return value is the number of items in the list box, or LB_ERR if an error occurs. ResThe returned count is one greater than the index value of the last item (the index is zero-based).
对不同的消息可以解释成不同的意义。
比如一个DWORD数值,或某种数据类型的指针。
很少有用SendMessage返回值的情况。
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
);
ParameterswParam
Not used; must be zero.
lParam
Not used; must be zero.
Return ValueThe 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;
);
ParameterswParam
Not used; must be zero.
lParam
Not used; must be zero.
Return ValueThe return value is the number of items in the list box, or LB_ERR if an error occurs. ResThe returned count is one greater than the index value of the last item (the index is zero-based).