Playing an AVI file in the status bar

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


Download demo project – 34 Kb

More by Author

Must Read