Click here to Skip to main content
13,199,026 members (42,837 online)
Click here to Skip to main content
Add your own
alternative version


55 bookmarked
Posted 8 Feb 2000

Animated Buttons

, 8 Feb 2000
Rate this:
Please Sign up or sign in to vote.
A class that show AVIs inside a button.

This class is a simple owner-draw CButton class that allows you to play animation files (AVI's) within the button. This class can be used like any other owner drawn control - simply include the header file, and declare your button controls as CAniButton instead of CButton

The class has the following methods:

BOOL Open( LPCTSTR lpszFileName );    // Open an AVI file using its filename
BOOL Open( UINT nID );              // Open an AVI file using its resource ID
void Play();                        // Start playing the animation 
void Stop();                        // Stop the animation
void Close();                       // Close the animation and free resources

To setup the button to play an animation, first add an AVI to your resources by editing the .rc file by hand and adding the following:

IDR_AVI1  AVI     DISCARDABLE     "res\\Animation.avi"

where Animation.avi is an AVI file in your /res directory (remember to define IDR_AVI1 in your resource.h file). Then, after creating the control (or in your dialogs OnInitDialog function, add the following

where m_Button is your animation button. </li />


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Raghav Gupta
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

Questionunknown identifier Pin
Vladimir199031-Mar-11 0:15
memberVladimir199031-Mar-11 0:15 
Hi, I'm fresh in Visual C++ programming, and I need to implement your code for this animated button in my project. But I can't seem to understand what this "IDC_ANIMATE1" is (because the Visual Studio 2010 says it's an unknown identifier) Smile | :)

I hope I'll get an answer, and I'm pretty sure that it's something very obvious - but I'm a newbie (:

Thank you
GeneralA quick solution.. Pin
Sicks15-Sep-05 2:44
sussSicks15-Sep-05 2:44 
GeneralProblem with Close() Pin
Sicks14-Sep-05 2:14
sussSicks14-Sep-05 2:14 
GeneralHELP !!!!!!!!!!! Pin
AnonymousCPopUpDlg dlg;10-Feb-02 1:49
memberAnonymousCPopUpDlg dlg;10-Feb-02 1:49 
GeneralRe: HELP !!!!!!!!!!! Pin
Piku8-Mar-03 19:36
memberPiku8-Mar-03 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 8 Feb 2000
Article Copyright 2000 by Raghav Gupta
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid