Click here to Skip to main content
11,409,532 members (64,880 online)
Click here to Skip to main content

CProgressFX and CHourglassFX

, 26 Sep 2001
Rate this:
Please Sign up or sign in to vote.
Two animation provider classes to add animation effects to any CWaitingTreeCtrl-derived class
<!-- Download Links -->

What are they?

Here I present some animation provider classes that you may use with any CWaitingTreeCtrl-derived class (see article). They're just examples now, they can serve you as starting points to implement much butter animation effects, but they can also be used "as-is" in your little projects.


This animation provider simply displays a progress bar while populating the tree.

Sample application

If the total count of items to add is known, it shows a linear progress bar, otherwise it maps the current progress (which would grow indefinitely) into a finite range allowing the bar to be displayed.


This animation provider simply displays an animated icon with the well-known hourglass.

Sample application

Note: I finally found the reason why my animated icons were successfully loaded only when linking to MFC dynamic libraries, and it doesn't have anything to do with MFC. The application I used to produce the animated icon, saved the file specifing the wrong size in the RIFF header. Those extra 8 bytes caused the system to read past the end of file, finding zeroes with dynamic libraries and the standard MFC resources with static libraries. It interpreted the zeroes like an EOF marker and returned successfully, while it didn't like the other bytes of subsequent resources thus returning a failure. The correct value in the RIFF header is the file size minus 8, so I just changed the double-word at offset 4 in the VC++ resource editor and got my icon even in static builds.

Using the Classes

Using animation provider classes is very easy. Suppose you have created your own content provider class: CMyTreeCtrl. If you want to add one or more animations you declare a variable as follows:

#include "MyTreeCtrl.h"

#include "ProgressFX.h"
#include "HourglassFX.h"


    CProgressFX< CHourglassFX< CMyTreeCtrl > > m_ctlMyTree;

And this is the result:

Sample application


17 Oct 2000

Initial public release.

27 Sep 2001

Fixed bug with animated icons
License changed to Artistic License


I hope there's someone who likes these classes and who wants to write his own. You may implement a new animation with an external progress control, or with a user selectable animated cursor, or with a message text that reports remaining items to load (like VS Class View), or everything you can imagine. If you do, it would be nice to see a new article about it. I will appreciate any comment, suggestion or improvement.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Paolo Messina
Software Developer RoboTech srl
Italy Italy
Paolo began programming at the age of 9 with a glorious 8086 and GW-BASIC, then he played a bit with C, ASM and Pascal. He tought himself MFC and Windows programming, to exploit his studies of C++. Always attracted by low-level programming and Assembly, he's beginning to appreciate the joys of templates and STL. At work he changed his mind about Java, discovered Eclipse IDE, and now think it's cool.

He lives in Follonica, Italy.

He has been abroad in the U.S. to work on his final thesis before graduating. For seven months he was playing with airplanes and automatic control at the Unversity of Illinois at Urbana-Champaign.

He graduated in Computer Science Engineering at the University of Pisa, Italy, in December 2003.

Currently working for an edutainment robotics company (
Follow on   Google+

Comments and Discussions

GeneralDialog did not respond when the animation activities Pinmembergolocy12-Jun-09 19:42 
QuestionHow to show % completion PinsussAnonymous21-Sep-04 8:53 
AnswerRe: How to show % completion PinmemberPaolo Messina25-Sep-04 8:58 
Generalexcellent idea PinmemberJeremy Falcon7-May-03 13:01 
Questionprogressbar ?? Pinmemberwimel27-Sep-01 23:41 
AnswerRe: progressbar ?? PinmemberPaolo Messina28-Sep-01 0:10 
GeneralWindows CE PinmemberAnonymous24-Apr-01 22:48 
GeneralRe: Windows CE PinmemberPaolo Messina25-Apr-01 0:12 
GeneralRe: Windows CE PinmemberAnonymous27-Apr-01 8:17 
GeneralRe: Windows CE PinmemberAnonymous30-Apr-01 10:41 
GeneralRe: Windows CE PinmemberAnonymous9-Jun-02 0:25 

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.150414.5 | Last Updated 27 Sep 2001
Article Copyright 2000 by Paolo Messina
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid