CAnimateCtrl() Example Code

Download Example Project - (145 kb)


Its pretty easy to implement an avi control. Follow these steps to add an avi animation control (CAnimateCtrl) to your dialog resource:

  • In the resource editor, click on the animate control icon, and place one on your dialog.
  • Go into 'Class Wizard' and add a control name to your newly inserted component. example:
  • CAnimateCtrl m_avi;
    

    this is placed in your .h file.

  • Next, import the .avi file into your project. To do this, highlite your resource project name, and right click in the resource view window. Select import. Set the filter to *.avi, and select the avi file you want to import.
  • Enter "AVI" for resource type in the custom resource type dialog box.
  • Add the following code to your project:
  •  /////////////////////////////////////////////////////////////////////////////
     // CAvidemoDlg message handlers
    
     BOOL CAvidemoDlg::OnInitDialog()
     {
        CDialog::OnInitDialog();
        ...
        ...
        // TODO: Add extra initialization here
        m_avi.Open( IDR_AVI ); // 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;
      }
    

Last updated: 29 March 1998



Comments

  • See also MSDN sample

    Posted by Legacy on 11/11/2002 12:00am

    Originally posted by: A. Hofmann

    CMNCTRL1 illustrates how to use the following common control MFC classes: CTreeCtrl, CToolBarCtrl, !!!!CAnimateCtrl!!!!, CDateTimeCtrl, and CMonthCalCtrl.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/_sample_mfc_cmnctrl1.asp

    Reply
  • Easy to follow

    Posted by Legacy on 06/07/2001 12:00am

    Originally posted by: Chokri Oueslati

    Very easy to follow implementation. Any Avi can be inserted this way. Thanks Kirk.

    Reply
  • CAnimateCtrl and Frame Number

    Posted by Legacy on 03/22/2001 12:00am

    Originally posted by: Andrew Tree

    I am trying to play an avi file using CAnimateCtrl but I am running into some problems. What I want to do is play an avi file, stop it somewhere in the middle, then restart it where I left off. Do you know how I can acomplish this task? I need some way of knowing what frame number I last displayed.

    Thanks,
    Andrew

    Reply
  • Solution for AVI problem

    Posted by Legacy on 01/29/2001 12:00am

    Originally posted by: Tom

    It can only open Microsoft RLE encoded AVI files

    Reply
  • THIS ARTICLE AND SOURCE CODE IS OUTDATED, PLEASE FOLLOW THIS LINK FOR THE LATEST UPDATE

    Posted by Legacy on 09/12/1999 12:00am

    Originally posted by: Kirk Stowell

    Hello,

    Until I am able to update this article, as an alternative, please visit this link http://www.codejock.com/ for the latest updates. As well my email address has changed, it is now kstowell@codejock.com

    Thanks,
    Kirk Stowell

    Reply
  • CAnimateCtrl won't load avi

    Posted by Legacy on 07/28/1999 12:00am

    Originally posted by: Richard Abbey

    The CAnimateCtrl will only load AVI's in uncompressed format, or in the RLE8 compression

    Reply
  • Globe AVI

    Posted by Legacy on 06/25/1999 12:00am

    Originally posted by: arindam maitra

    I tried to use your approach to do the following:
    I went to c:\windows\cursors\ dir to get the globe.ani
    animated image and do exactly what you said but the image never showed up ... what happened???

    Reply
  • AVI Demo

    Posted by Legacy on 04/23/1999 12:00am

    Originally posted by: Manoj Singh

    I appreciated your avi demo application. I tried to animate
    dragdrop.avi from c:\windows\help , but failed. How to animate any other file instead of filecopy.avi.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 23, 2014 @ 12:00 p.m. ET / 9:00 a.m. PT Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this eSeminar to learn why physical appliances are preferable to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds