Working with Common Controls

Common controls are a set of windows supported by the common control library; a dynamic-link library (DLL) included with the Windows CE OS. Like other control windows, a common control is a child window that an application uses in conjunction with another window to perform I/O tasks.

Common controls offer users a familiar interface for performing common tasks, which makes applications easier to use and learn. Most common controls send the WM_NOTIFY message instead of the WM_COMMAND message sent by window controls.

The following list shows common controls supported by Windows CE.

Command bars Tree views
Command bands Up-down controls
Rebars Date and time picker
Toolbars Month calendar controls
ToolTips Status bars
Header controls Progress bars
Image lists Property sheets
List views Tab controls
Trackbars  

Windows CE does not support the following controls commonly used on Windows-based desktop platforms: animation controls, ComboBoxEx controls, drag lists, flat scroll bars, hot keys, Internet Protocol (IP) address controls, or Rich Ink edit controls.

Before you create or use any common controls, you must register them. You can do this in either of two ways: call the InitCommonControls function, which registers all the common controls at once except for the rebar, month calendar, and date and time picker controls, or call the InitCommonControlsEx function, which registers a specific common control class. Calling either of these functions ensures that the common DLL is loaded.

To use most of the common controls, you must include the Commctrl.h header file in your application. To use property sheets, you must include the Prsht.h header file.

When creating a common control, it is important to understand that all common controls are child windows that you create by calling CreateWindowEx. You can also create a common control by calling a control-specific API function. Because common controls are windows, you can manage them the same way that you manage other application windows.

Though Windows CE supports some styles that apply to a broad spectrum of common controls, each of the common controls also has a set of styles unique to that control. Unless otherwise noted, these unique styles apply to header controls, toolbar controls, rebars, and status windows. For a complete listing of supported styles, see Window and Control Styles.