Share via


About Animation Controls (Windows CE 5.0)

Send Feedback

A common use for an animation control is to indicate system activity during a lengthy operation.

An animation control can display an AVI clip originating from either an uncompressed AVI file or from an AVI file that was compressed using run-length (BI_RLE8) encoding. You can add the AVI clip to your application as an AVI resource, or the clip can accompany your application as a separate AVI file.

The AVI file, or resource, must not have a sound channel. The capabilities of the animation control are very limited and are subject to change.

Animation controls always uses a WIN 32 timer to synchronize playback. Applications must make sure that they do not block.

Note   Windows CE does not support a separate thread for the AVI playback. As a result, an application that uses animation controls must ensure that it will not block the user interface, otherwise the animation will not occur.

Creating an Animation Control

An animation control belongs to the ANIMATE_CLASS window class.

You create an animation control by using the CreateWindow function or the Animate_Create macro. The macro positions the animation control in the upper-left corner of the parent window and, if the ACS_CENTER style is not specified, sets the width and height of the control based on the dimensions of a frame in the AVI clip.

If ACS_CENTER is specified, Animate_Create sets the width and height of the control to zero. You can use the SetWindowPos function to set the position and size of the control.

If you create an animation control within a dialog box or from a dialog box resource, the control is automatically destroyed when the user closes the dialog box. If you create an animation control within a window, you must explicitly destroy the control.

Animation Control Messages

An application sends messages to an animation control to open, play, stop, and close the corresponding AVI clip. Each message has one or more macros that you can use instead of sending the message explicitly.

After creating an animation control, an application sends the ACM_OPEN (Shell and User Interface) message to open an AVI clip and load it into memory. The message specifies either the path of an AVI file or the name of an AVI resource. The system loads the AVI resource from the application that created the animation control.

If the animation control has the ACS_AUTOPLAY style, the control begins playing the AVI clip immediately after the AVI file or AVI resource is opened. Otherwise, an application can use the ACM_PLAY message to start the AVI clip.

An application can stop the clip at any time by sending the ACM_STOP message. The last frame played remains displayed when the control finishes playing the AVI clip or when ACM_STOP is sent.

An animation control can send two notification messages, ACN_START and ACN_STOP, to its parent window. Most applications do not handle either notification.

To close the AVI file or AVI resource and remove it from memory, an application can use the Animate_Close macro, which sends ACM_OPEN with the file name or resource name set to NULL.

Default Message Processing

This section describes the window messages handled by the window procedure for the ANIMATE_CLASS window class.

Window Message Description
WM_CLOSE Frees the AVI file or AVI resource associated with the animation control.
WM_DESTROY Frees the AVI file or AVI resource, frees an internal data structure, and then calls the DefWindowProc function.
WM_ERASEBKGND Erases the window background using the current background color for static controls.
WM_PAINT Draws an AVI frame in the animation control.
WM_SIZE Checks if the control has the ACS_CENTER style. If the control does not, it calls DefWindowProc. Otherwise, it centers the animation in the control, invalidates the control, and then calls DefWindowProc.

See Also

Animation Controls Styles | Animation Controls

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.