AVI – Animated button

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

You can see this effect on some multimedia programs: as you drag mouse over
the button, the button will animate.
The whole thing is in CAniButton class derived from CButton.

Use CAniButton as a normal CButton (Style must be Owner draw)
On Init dialog simply use LoadAVI( AVI_ID ) where AVI_ID is ID of AVI file
loaded in resources.

The button will resize to match the size of AVI animation.
The first frame of animation will be used as a static look.
Be careful when you create your own AVI file. Not everything could be played !

Here is what is written for Animated control in MSDN:

Animation controls can play only simple AVI clips. Specifically, the clips
to be played by an animation control must meet the following requirements:

-There must be exactly one video stream and it must have at least one frame.

-There can be at most two streams in the file (typically the other stream,
if present, is an audio stream, although the animation control ignores
audio information).

-The clip must either be uncompressed or compressed with RLE8 compression.

-No palette changes are allowed in the video stream.

Download source 41KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read