How to Use animation controls in a dialog box Program

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.