Click here to Skip to main content
Click here to Skip to main content

Animated Buttons

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

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

m_Button.Open(IDR_AVI1);
m_Button.Play();
where m_Button is your animation button.

License

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

Share

About the Author

Raghav Gupta

United States United States
No Biography provided

Comments and Discussions

 
Questionunknown identifier PinmemberVladimir199031-Mar-11 1:15 
GeneralA quick solution.. PinsussSicks15-Sep-05 3:44 
GeneralProblem with Close() PinsussSicks14-Sep-05 3:14 
GeneralHELP !!!!!!!!!!! PinmemberAnonymousCPopUpDlg dlg;10-Feb-02 2:49 
GeneralRe: HELP !!!!!!!!!!! PinmemberPiku8-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    Rant Rant    Admin Admin   

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

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