Microsoft KB Archive/65881

{|
 * width="100%"|

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

 * }

Q65881

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)
 * Microsoft Windows Software Development Kit (SDK) versions 3.0, 3.1

-

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:


 * A combo box itself, of window class &quot;ComboBox&quot;
 * An edit control, of window class &quot;Edit&quot;
 * A list box, of window class &quot;ComboLBox&quot;

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 query words: control focus release win16sdk

Keywords : kbComboBox kbCtrl kbOSWinNT kbOSWin2000 kbGrpDSUser kbOSWin

Issue type : kbinfo

Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWinSDKSearch kbWinSDK300 kbWinSDK310