OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
About the Animate Control

The TAnimateCtrl class encapsulates the Animation Control (a window that silently displays an AVI (Audio Video Interleaved) clip.

Note
The animation control can only play silent clips from an uncompressed .AVI file or from an .AVI file that was compressed using run-length encoding (RLE).

Creating a New Control

To create a new control, use the TAnimateCtrl(parent, id, x, y, w, h, module) constructor. For example, you could use the following code within the constructor of a parent window:

TClientWindow::TClientWindow(TWindow* parent)
: TWindow(parent)
{
AnimateCtrl = new TAnimateCtrl(this, 0x100, 5, 10, 50, 60);
};

This creates an animation control with the ID of 0x100, at location (5,10), 50 pixels wide and 60 pixels high within the client area of the TClientWindow window.

Aliasing a Control

To alias an animation control which is part of a dialog resource, use the TAnimateCtrl(parent, resourceId, module) constructor. The following resource definition creates a dialog containing an animation control:

IDD_ANIMATE DIALOG 45, 56, 176, 99
CAPTION "Animation Dialog"
{
CONTROL "Sample_Avi", IDC_ANIMATE, "SysAnimate32", ACS_CENTER | ACS_TRANSPARENT | WS_CHILD | WS_VISIBLE | WS_BORDER, 16, 10, 145, 61
}

The following code shows how to alias an animation control within the constructor of a Tdialog-derived class:

TAnimDialog::TAnimDialog(TWindow* parent, TResId res)
: TDialog(parent, res)
{
AnimCtrl = new TAnimateCtrl(this, IDC_ANIMATE);
}

Additional Information

The specified caption of the control may contain the name of an .AVI resource to be opened automatically by the control.

Passing -1 as the third argument to the Play method instructs the control to replay the clip indefinitely.

Using the Animate Control

  1. Create the control.
  2. Invoke the Open method to open an .AVI clip and load it into memory:
    Note
    The parameter to the Open method can contain the path to an .AVI file or the name of an AVI resource.
  3. Use the Play method to play the current AVI clip in the animation window. The control plays the clip in the background while the thread continues executing.
  4. Use the Seek method to seek to a particular frame of the current AVI clip.
  5. Use the Stop method to stop playing an AVI clip.