Playing an AVI file in the status bar


Application Security Testing: An Integral Part of DevOps

Sample Image

Environment: VC6 SP2, NT4, 9x

During some long data processing, it is useful to let the user know that "something is happening, honest!" Many programs (such as Outlook Express) do this by the neat trick of showing an animation within one of the status bar panes. This article shows how this can be achieved by embedding an animation control.

The demo program allows a simple animation to be switched on or off from the View menu.

To add status bar animation takes the following steps:

1. Add the files RJLStatusBar.cpp and .h and StatusbarAnimate.cpp and .h to your project.

2. Add a CStatusbarAnimate* member in your CMainFrame class; change the CStatusBar member to be of the class CRJLStatusBar.

3. Add a suitable AVI resource to your resource file (you need some form of AVI editor to create this--I used Corel Photo-Paint 8). The AVI is drawn transparently, with the upper left pixel being the transparency color. Make sure that the status bar pane that will display this is large enough (controlled by the length of the text associated with the pane ID).

4. Add the following code to CMainFrame:

	m_pAnimate = NULL;


void CMainFrame::StartAnimation( UINT id, int nPane /*=1*/ )

	m_pAnimate = new CStatusbarAnimate;
	m_pAnimate->Create(id, nPane);

void CMainFrame::StopAnimation()
	delete m_pAnimate;
	m_pAnimate = NULL;

bool CMainFrame::IsAnimationActive()
	return (m_pAnimate != NULL);

// needed to ensure original text not visible
void CMainFrame::OnUpdateAnimate(CCmdUI* pCmdUI) 

Now to start the animation just call StartAnimation and to stop it call StopAnimation.


Download demo project - 34 Kb


  • Compile under Visual C 5

    Posted by Legacy on 09/08/2003 12:00am

    Originally posted by: Skippy

    Get this to compile under visual c 5, replace the following:

    TRACE0("Failed to create toolbar\n");
    return -1; // fail to create


    if (!m_wndToolBar.Create(this) ||
    TRACE0("Failed to create toolbar\n");
    return -1;

    If you need to compile on both, use:
    #if _MSC_VER > 1100
    // version 5
    // version 6

  • Solution for disappearance the animate control when window is Iconic

    Posted by Legacy on 03/05/2003 12:00am

    Originally posted by: Karthikeyan

    The reason for disappearance of the Animation when we minimize the window is that when we minimize the window, the status bar also changes in its size. but, we loaded the animate control on the status bar. So, its position also changes. So that it disappears. To avoid that we have to write the code in the status bar class's OnSize event like the following.

    CRect rc;
    rc.InflateRect (-1,-1);
    m_CtrlAnimate.MoveWindow (&rc,TRUE);

  • Download .AVI files

    Posted by Legacy on 08/27/2000 12:00am

    Originally posted by: Alex Marbus

    First of all, thanks for this great code you've written..!
    I was wondering if anyone knows a good resource where I can download AVI files, for example the ones that MS uses in Word while printing/loading/saving. I've searched almost the entire web, I think, but found none..
    So, if anyone knows a good resource, and wish to share it.. maybe he/she can post it here?


  • Thankyou immensely

    Posted by Legacy on 04/24/2000 12:00am

    Originally posted by: Vince Buttigieg

    Your code is invaluablscofrpioe ;-)
    I created an amination of my company's logo which I wanted to put in every program I write, but couldn't find a good spot to place it... the status bar is perfect and your code works great. You're a legend

  • AVI got lost when the frame window is resized to a smaller size

    Posted by Legacy on 04/07/2000 12:00am

    Originally posted by: deT

    Drag the lower right conner of the frame and move it to the upper left. You will see that the animation disappears.

  • AVI animation in Status Window

    Posted by Legacy on 01/18/2000 12:00am

    Originally posted by: Johnny

    That was slick. Where can a developer find an application (free) that could produce an animated file? I looked for Microsoft's AVIEdit at their site, but only found a simple "sample editor" which I could not understand.

    Thanks all.

  • Thanks

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

    Originally posted by: Billy-Bob-Joe

    Thanks a lot. I really needed that code.

  • Thanks

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

    Originally posted by: Billy-Bob-Joe

    Thanks a lot. I really needed that code.

  • How to play MPEG I / MPEG II file

    Posted by Legacy on 08/29/1999 12:00am

    Originally posted by: wfs

    How to play MPEG I / MPEG II file

  • You must have javascript enabled in order to post comments.

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

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.