SDK中,我用编辑器画了个组合框,怎么来设置里边的文字呢?
SDK中,我用编辑器画了个组合框,怎么来设置里边的文字呢?
具体怎么做的,能写2个例子看看吗,送50分.非常感谢.
[解决办法]
ComboBox_AddString
[解决办法]
向这个控件发相关消息,你要的是加入字串,可发送:CB_ADDSTRING消息,下面是CB_ADDSTRING的用法:(抄自MSDN)
CB_ADDSTRING
An application sends a CB_ADDSTRING message to add a string to the list box of a combo box. If the combo box does not have the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted.
To send this message, call the SendMessage function with the following parameters.
SendMessage(
(HWND) hWnd, // handle to destination window
CB_ADDSTRING, // message to send
(WPARAM) wParam, // not used; must be zero
(LPARAM) lParam // string to add (LPCTSTR)
);
Parameters
wParam
This parameter is not used.
lParam
Pointer to the null-terminated string to be added. If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the value of the lParam parameter is stored as item data rather than the string it would otherwise point to. The item data can be retrieved or modified by sending the CB_GETITEMDATA or CB_SETITEMDATA message.
Return Values