How to Control the AVI Clip
This topic demonstrates how to use the animation control macros to play, stop, and close an associated Audio-Video Interleaved (AVI) clip.
What you need to know
Technologies
Prerequisites
- C/C++
- Windows User Interface Programming
- AVI files
Instructions
Create a function that takes as parameters a handle to the animation control and a flag that indicates the action to be performed on the associated AVI clip.
The function in the following C++ example calls one of three animation control macros (Animate_Play, Animate_Stop, Animate_Close) based on the value of the nAction parameter. The handle to the animation control that is associated with the AVI clip is passed via the hwndAnim parameter.
// DoAnimation - plays, stops, or closes an animation control's
// AVI clip, depending on the value of an action flag.
// hwndAnim - handle to an animation control.
// nAction - flag that determines whether to play, stop, or close
// the AVI clip.
void DoAnimation(HWND hwndAnim, int nAction)
{
int const PLAYIT = 1, STOPIT = 2, CLOSEIT = 3;
switch (nAction) {
case PLAYIT:
// Play the clip continuously starting with the
// first frame.
Animate_Play(hwndAnim, 0, -1, -1);
break;
case STOPIT:
Animate_Stop(hwndAnim);
break;
case CLOSEIT:
Animate_Close(hwndAnim);
break;
default:
break;
}
return;
Related topics