Click here to Skip to main content
13,289,326 members (55,103 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 1:15
memberVladimir199031-Mar-11 1:15 
GeneralA quick solution.. Pin
Sicks15-Sep-05 3:44
sussSicks15-Sep-05 3:44 
GeneralProblem with Close() Pin
Sicks14-Sep-05 3:14
sussSicks14-Sep-05 3:14 
GeneralHELP !!!!!!!!!!! Pin
AnonymousCPopUpDlg dlg;10-Feb-02 2:49
memberAnonymousCPopUpDlg dlg;10-Feb-02 2:49 
GeneralRe: HELP !!!!!!!!!!! Pin
Piku8-Mar-03 20:36
memberPiku8-Mar-03 20:36 
Hey, i think u havent read the article properly.
The mwthods are part of CAniButton,not CButton.
So make the proper changes and recompile!
Blush | :O

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
Web02 | 2.8.171207.1 | Last Updated 8 Feb 2000
Article Copyright 2000 by Raghav Gupta
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid