Many people wantProgram. This article will teach you how to add AVI animation control (canimatectrl) in a dialog box-based program step by step ). As long as you know the method, the whole process is very simple. Figure 1 shows the program running screen in this example. This program uses the AVI animation that represents the file copy. Next we will look at the specific implementation method.
In the dialog box resource editor, open the dialog box and add an animation control (animate ). Then, enter the Class Wizard "Class Wizard" to define a variable for the control you just added. Assume that the variable is named canimate m_avi. Select "control" for the variable type (category ". This definition is automatically added to the. h file.
Next, we will introduce the. AVI file into the project. In the project resource View window (resourceview), select the Project Resource Name, right-click, and select "import" from the context menu ". Select "all files (*. *)" for file type filtering (*.*)". Select the. AVI file to be introduced. Define a resource ID. Enter "Avi" in the Custom Resource Type dialog box ". Then add the following to the initialization routine (oninitdialog () in the dialog box:Code:
////////////////////////////////////// //////////////////////////////////////// /cavidemodlg message handlersbool cavidemodlg:: oninitdialog () {cdialog: oninitdialog ();...... // todo: add extra initialization here m_avi.open (idr_avi3); // open the AVI resource. m_avi.play (0,-1,-1); play AVI resource. // return true unless you set the focus to a control Return true ;}
compile the program. Whether you believe it or not, it's that simple.