共用方式為


CAnimateCtrl::Open

Call this function to open an AVI clip and display its first frame.

BOOL Open( 
   LPCTSTR lpszFileName  
); 
BOOL Open( 
   UINT nID  
);

Parameters

  • lpszFileName
    A CString object or a pointer to a null-terminated string that contains either the name of the AVI file or the name of an AVI resource. If this parameter is NULL, the system closes the AVI clip that was previously opened for the animation control, if any.

  • nID
    The AVI resource identifier. If this parameter is NULL, the system closes the AVI clip that was previously opened for the animation control, if any.

Return Value

Nonzero if successful; otherwise zero.

Remarks

The AVI resource is loaded from the module that created the animation control.

Open does not support sound in an AVI clip; you can open only silent AVI clips.

If the animation control has the ACS_AUTOPLAY style, the animation control will automatically start playing the clip immediately after it opens it. It will continue to play the clip in the background while your thread continues executing. When the clip is done playing, it will automatically be repeated.

If the animation control has the ACS_CENTER style, the AVI clip will be centered in the control and the size of the control will not change. If the animation control does not have the ACS_CENTER style, the control will be resized when the AVI clip is opened to the size of the images in the AVI clip. The position of the top left corner of the control will not change, only the size of the control.

If the animation control has the ACS_TRANSPARENT style, the first frame will be drawn using a transparent background rather than the background color specified in the animation clip.

Example

See the example for CAnimateCtrl::CAnimateCtrl.

Requirements

Header: afxcmn.h

See Also

Reference

CAnimateCtrl Class

Hierarchy Chart

CAnimateCtrl::Close

CAnimateCtrl::Create