Playing an AVI file in the status bar | CodeGuru

Playing an AVI file in the status bar

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 6, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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:

CMainFrame::CMainFrame()
{
	m_pAnimate = NULL;
}

CMainFrame::~CMainFrame()
{
	StopAnimation();
}

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

	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)
{
	pCmdUI->SetText(_T(""));
}

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

Downloads

Download demo project – 34 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.