Windows CE 2.1 Technical Articles  

Using the CommandBand Controls in Microsoft Windows CE

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Rodney Rushing
Microsoft Corporation

July 1999

Summary:Microsoft Windows CE contains a new control called the CommandBand, a hybrid of the "rebar" control found on the Windows desktop and server platforms and the traditional menu bar. CommandBand controls can host buttons, menu items, and even combo boxes. With the CommandBand, Windows CE provides a compact, efficient visual control that serves multiple purposes without consuming too much valuable screen real estate. (15 printed pages)

Click hereto download the sample file associated with this page from the Downloads Center.

The Windows CE operating system contains many of the same visual controls and elements as its traditional desktop cousin. In fact, developers looking to build GUI-based applications for Windows CE will find that the skills and experience they acquired while constructing Windows desktop and server applications also apply to Windows CE.

The CommandBand Control

Windows CE contains a new control called the CommandBand, a hybrid of the "rebar" control found on the Windows desktop and server platforms and the traditional menu bar. CommandBand controls can host buttons, menu items, and even combo boxes. With CommandBand controls, Windows CE provides a compact, efficient visual control that serves multiple purposes without consuming too much valuable screen real estate.

The Check List Sample

The Check List Sample, available for download at the beginning of this article, demonstrates the use of several Win32 programming interfaces, combining them into a functional application. The primary purpose of this application is to demonstrate the use of the CommandBand (rebar) control. However, several ancillary Windows CE development concepts are also explored. Minimal error checking is done to make the sample concepts a little easier to study.

The program functions as a simple checklist manager, enabling users to create multiple categories of check lists, then add items to each check list.

Figure 1. Category view on a Palm-size PC

Items can be "checked" off of the list to show completion of the items that were checked. Further, each item also has a value associated with it that is added to a total when the item is checked. For example, in a grocery list, the value might indicate the estimated cost of each item. As each item is checked, its value is added to the check list "total."

Figure 2. Check list view on a Handheld PC

Categories and items can be created, edited, and deleted, and all state information is persisted in a Windows CE database.

Using the Command Bands

The first screen displayed is always the categories view. On first execution, this view will contain a rebar with a menu and a toolbar. The rebar can be customized by: