The common controls are a set of windows that are implemented by the common control library, which is a DLL included with the Microsoft Windows operating system. Like other control windows, a common control is a child window that an application uses in conjunction with another window to enable interaction with the user.
Creating Common Controls
Most common controls belong to a window class defined in the common control DLL. The window class and the corresponding window procedure define the properties, appearance, and behavior of the control. To ensure that the common control DLL is loaded, include the InitCommonControlsEx function in your application. You create a common control by specifying the name of the window class when calling the CreateWindowEx function or by specifying the appropriate class name in a dialog box template.
DLL Versions
All 32-bit versions of Windows include a common controls DLL, Comctl32.dll. However, this DLL has been updated several times since it was first introduced. Each successive version supports the features and API of earlier versions. However, each new version also contains a number of new features and a correspondingly larger API. Applications must be aware of which version of Comctl32.dll is installed on a system, and only use the features and API that the DLL supports.
Because new versions of the common controls were distributed with Windows Internet Explorer, the version of Comctl32.dll that is active is sometimes different from the version that was shipped with the operating system. Therefore, it is not enough for your application to know which operating system it is running on. It must directly determine which version of Comctl32.dll is present. For a detailed discussion of common controls versions and how to determine which version of Comctl32.dll is installed, see Shell and Common Controls Versions.
Structure Sizes for Different Common Control Versions
Ongoing enhancements to common controls have resulted in the need to extend many of the structures. For this reason, the size of the structures has changed between different versions of Commctrl.h. Because most of the common control structures take a structure size as one of the parameters, a message or function can fail if the size is not recognized. To remedy this, structure size constants have been defined to aid in targeting different version of Comctl32.dll. The following list defines the structure size constants.
|
HDITEM_V1_SIZE
|
The size of the HDITEM structure in version 4.0.
|
|
IMAGELISTDRAWPARAMS_V3_SIZE |
The size of the IMAGELISTDRAWPARAMS structure in version 5.9.
|
|
LVCOLUMN_V1_SIZE
|
The size of the LVCOLUMN structure in version 4.0.
|
|
LVGROUP_V5_SIZE |
The size of the LVGROUP structure in version 6.0.
|
|
LVHITTESTINFO_V1_SIZE
|
The size of the LVHITTESTINFO structure in version 4.0.
|
|
LVITEM_V1_SIZE
|
The size of the LVITEM structure in version 4.0.
|
|
LVITEM_V5_SIZE |
The size of the LVITEM structure in version 6.0.
|
|
LVTILEINFO_V5_SIZE |
The size of the LVTILEINFO structure in version 6.0.
|
|
NMLVCUSTOMDRAW_V3_SIZE
|
The size of the NMLVCUSTOMDRAW structure in version 4.7.
|
|
NMTTDISPINFO_V1_SIZE
|
The size of the NMTTDISPINFO structure in version 4.0.
|
|
NMTVCUSTOMDRAW_V3_SIZE
|
The size of the NMTVCUSTOMDRAW structure in version 4.7.
|
|
PROPSHEETHEADER_V1_SIZE
|
The size of the PROPSHEETHEADER structure in version 4.0.
|
|
PROPSHEETPAGE_V1_SIZE
|
The size of the PROPSHEETPAGE structure in version 4.0.
|
|
REBARBANDINFO_V3_SIZE
|
The size of the REBARBANDINFO structure in version 4.7.
|
|
REBARBANDINFO_V6_SIZE
|
The size of the REBARBANDINFO structure in version 6.0.
|
|
TTTOOLINFO_V1_SIZE
|
The size of the TOOLINFO structure in version 4.0.
|
|
TTTOOLINFO_V2_SIZE |
The size of the TOOLINFO structure in version 4.7.
|
|
TTTOOLINFO_V3_SIZE |
The size of the TOOLINFO structure in version 6.0.
|
|
TVINSERTSTRUCT_V1_SIZE
|
The size of the TVINSERTSTRUCT structure in version 4.0.
|
Common Control Styles
Each type of common control has a set of control styles that you can use to vary the appearance and behavior of the control. The common control library also includes a set of control styles that apply to two or more types of common controls. The common control styles are described in the Styles section.
Unicode Support
For Shell and Common Controls Versions 5.80 and later of comctl32.dll, common controls notifications support both ANSI and Unicode formats on Windows 95 systems or later. The system determines which format to use by sending your window a WM_NOTIFYFORMAT message. To specify a format, return NFR_ANSI for ANSI notifications or NFR_UNICODE for Unicode notifications. If you do not handle this message, the system calls IsWindowUnicode to determine the format. Since Windows 95 and Windows 98 always return FALSE to this function call, they use ANSI notifications by default.
Related Topics