INF: Determining Selected Items in a Multiselection List Box

ID Number: Q71759

3.00

WINDOWS

Summary:

To obtain the indexes of all the selected items in a multiselection

list box, the LB_GETSELITEMS message should be sent to the list box.

The message LB_GETCURSEL cannot be used for this purpose because it is

designed for use in single-selection list boxes.

Another approach is to send one LB_GETSEL message for every item of

the multiselection list box to get its selection state. If the item is

selected, LB_GETSEL returns a positive number. The indexes can be

built into an array of selected items.

For more information about the LB_GETSELITEMS message, see page 6-38

in the "Windows Software Development Kit Reference Volume 1."