INF: The Parts of a Windows Combo Box and How They Relate

ID Number: Q65881

3.00

WINDOWS

Summary:

A Windows combo box is a compound structure composed of individual

windows. Three types of windows can be created as part of a combo box:

1. A combo box itself, of window class "ComboBox"

2. An edit control, of window class "Edit"

3. A list box, of window class "ComboLBox"

The relationship among these three windows varies depending upon the

different combo box styles.

More Information:

For combo boxes created with the CBS_SIMPLE styles, the ComboBox

window is the parent of the edit control and the list box that is

always displayed on the screen. When GetWindowRect() is called for a

combo box of this style, the rectangle returned contains the edit

control and the list box.

Combo boxes created with the CBS_DROPDOWNLIST style have no edit

control. The region of the combo box that displays the current

selection is in the ComboBox window itself. When GetWindowRect() is

called for a combo box of this style, the rectangle returned does not

include the list box.

For combo boxes created with the CBS_DROPDOWN style, three windows are

created. The combo box edit control is a child of the ComboBox window.

When GetWindowRect() is called for a combo box of this style, the

rectangle returned does not include the list box.

However, the ComboLBox (list box) window for combo boxes that have the

CBS_DROPDOWN or CBS_DROPDOWNLIST style is not a child of the ComboBox

window. Instead, each ComboLBox window is a child of the desktop

window. This is required so that, when the drop-down list box is

dropped, it can extend outside the application window or dialog box.

Otherwise, the list box would be clipped at the window or dialog box

border.

Because the ComboLBox window is not a child of the ComboBox window,

there is no simple method to get the handle of one window, given the

other. For example, given a handle to the ComboBox, the handle to any

associated drop-down list box is not readily available. The ComboLBox

is a private class registered by USER that is a list box with the

class style CS_SAVEBITS.

Additional reference words: control focus release 3.00 MICS3 R1.7