Rediger

Del via


CB_GETLBTEXT message

Gets a string from the list of a combo box.

Parameters

wParam

The zero-based index of the string to retrieve.

lParam

A pointer to the buffer that receives the string. The buffer must have sufficient space for the string and a terminating null character. You can send a CB_GETLBTEXTLEN message prior to the CB_GETLBTEXT message to retrieve the length, in TCHARs, of the string. If it is an ANSI string this is the number of bytes, but if it is a Unicode string this is the number of characters.

Return value

The return value is the length of the string, in TCHARs, excluding the terminating null character. If wParam does not specify a valid index, the return value is CB_ERR.

Remarks

Security Warning: Using this message incorrectly can compromise the security of your program. This message does not provide a way for you to know the size of the buffer. If you use this message, first call CB_GETLBTEXTLEN to get the number of characters that are required and then call the message to retrieve the string. You should review the Security Considerations: Microsoft Windows Controls before continuing.

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the buffer pointed to by lParam receives the data associated with the item.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

CB_GETLBTEXTLEN