Up-Down Control Messages and Member Functions

There aren't a lot of messages and member functions for up-down controls. Table 2-4 lists the messages that can be sent to up-down controls and the member functions that are supported by the MFC-supplied class CSpinButtonCtrl. The Win32 SDK and the MFC 3.1 documentation contain detailed information about parameters and return values.

Message Member Function Description
UDM_GETACCEL GetAccel Retrieves information about the accelerators for an up-down control. (You can set accelerator keys for this control.)
UDM_GETBASE GetBase Retrieves the current base value for an up-down control (10 for decimal or 16 for hexadecimal).
UDM_GETBUDDY GetBuddy Retrieves the window handle of the current buddy control.
UDM_GETPOS GetPos Retrieves the current position of an up-down control.
UDM_GETRANGE GetRange Retrieves the upper and lower bounds for an up-down control.
UDM_SETACCEL SetAccel Sets the accelerators for an up-down control.
UDM_SETBASE SetBase Sets the base value for an up-down control (10 for decimal or 16 for hexadecimal). The base value determines whether the buddy control displays numbers in decimal digits or in hexadecimal digits. Hexadecimal numbers are unsigned; decimal numbers are signed. If the buddy control is a list box, the up-down control sets its current selection instead of its text.
UDM_SETBUDDY SetBuddy Sets the buddy control for an up-down control

Table 2-4. (continued)

Up-down control messages and member functions.

Message Member Function Description
UDM_SETPOS SetPos Sets the current position for an up-down control.
UDM_SETRANGE SetRange Sets the upper and lower bounds for an up-down control.

Animation Controls

When some of you saw the words animation control, you probably got all excited and wondered what this control could be. An animation control is simply a window that displays an audio-video interleaved (AVI) clip. AVI is the standard Windows audio-video format. An AVI clip is a series of bitmap frames, something like a movie. Although AVI clips can have sound, animation controls ignore sound information when they play these clips.

Because the thread continues to execute while an AVI clip is being displayed, you'll often see animation controls used to indicate system activity during a lengthy operation. For example, the Find dialog box (see Figure 2-8) shows a magnifying glass moving over a piece of paper.

Figure 2-8.

A dialog box containing an animation control.

The AVI clip can originate either from an uncompressed AVI file or from an AVI file that was compressed using run-length encoding (RLE). You can add the clip to your application as an AVI resource, or the clip can accompany your application as a separate AVI file. You can create the AVI file using one of the many tools on the market, such as those available with the Microsoft Video for Windows SDK or with Adobe Premier.

Because you are limited by the type of compression (RLE or none), you won't be able to play some of the really neat animations—Bugs Bunny, for instance—in the control. If you need a control to provide multimedia playback and recording capabilities for your application, you should use the MCIWnd control instead of an animation control.