Programming Windows with MFC, Second Edition
Chapter 16
Since version 1.0, Microsoft Windows has provided a core set of controls that includes push buttons, radio buttons, list boxes, and other common user interface (UI) objects. Windows 95 and Windows NT 3.51 expanded the selection of controls available by including 15 new control types in a DLL named Comctl32.dll. Collectively known as the common controls, these controls run the gamut from simple progress controls, which provide graphical feedback regarding the progress of ongoing operations, to richer and more complex tree view controls, which present hierarchical views of data in treelike structures whose branches expand and collapse in response to mouse clicks. Microsoft Internet Explorer adds even more controls to Comctl32.dll, bringing the total number of common controls supported on today's platforms to 20. The suite of controls provided by Internet Explorer includes controls for selecting dates and times, entering Internet Protocol (IP) addresses, and more.
Common controls are used throughout Windows and are an important part of the operating system's look and feel. Figure 16-1 shows how Windows uses some of the common controls. The header control in the Explorer window is a part of the list view control, but header controls can also be created apart from list views. The magnifying glass that moves in a circle while Find performs a search is an animation control. So are the pieces of paper that fly across the screen when files are moved, copied, or deleted. As you'll see later, animation controls make it easy to display simple animations by playing back sequences recorded in Windows Audio Video Interleaved (AVI) format.
Figure 16-1. Common controls and the Windows user interface.
In this chapter, I'll introduce the common controls and their MFC interfaces. I'll begin with an overview of the common controls and then explain how they're created and the unique way in which they send notifications to their parents. After that, we'll examine several of the common controls in detail and go over sample code demonstrating their use.