调用SendMessage函数
增加一个列表项 CB_ADDSTRING
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) CB_ADDSTRING, // message ID
(WPARAM) wParam, // = 0; not used, must be zero
(LPARAM) lParam // = (LPARAM) (LPCTSTR) lParam;
);
lParam指向一个以null结束的字符串,将被加入的列表项
删除一个列表项 CB_DELETESTRING
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) CB_DELETESTRING, // message ID
(WPARAM) wParam, // = (WPARAM) () wParam;
(LPARAM) lParam // = 0; not used, must be zero
);
wParam指定将被删除列表项的下标(从0开始)
取得选定的项 CB_GETCURSEL
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) CB_GETCURSEL, // message ID
(WPARAM) wParam, // = 0; not used, must be zero
(LPARAM) lParam // = 0; not used, must be zero
);
返回值了lResult包含了当前被选择的列表项的下标(从0开始)