Click here to Skip to main content
13,803,704 members
Click here to Skip to main content
Add your own
alternative version


91 bookmarked
Posted 3 Nov 2008
Licenced CPOL

XProgressWnd - A Popup Progress Window with optional AVI and time

, 3 Nov 2008
Rate this:
Please Sign up or sign in to vote.
XProgressWnd is a popup progress window that display a progress control and optional AVI animation and estimated time left, without requiring a dialog resource.


I have been using Chris Maunder's excellent Popup Progress Window for some time now, and wanted to add an AVI animation and "time left" display similar to what you see in IE:


XProgressWnd Window

Here is what XProgressWnd looks like:


and when you select all options:


Changes in Version 2.0

Here are the changes I made to Chris's control: <TABLE style="MARGIN-LEFT: 15px" cellSpacing=7 cellPadding=0 screenshot Added optional AVI animation. screenshot Added optional estimated time left, with ability to customize labels. screenshot Added [X] (Close) button to progress window. screenshot Used memory DC to eliminate flickering of message text. Text can now be changed dynamically during progress display, with no flickering. screenshot Fixed problem with NONCLIENTMETRICS and VS2008, plus several other issues reported in forum.

Demo App

The demo app allows you to select an AVI, the progress range, and other options:


How To Use

To integrate CXProgressWnd into your app, you first need to add following files to your project:

  • XProgressWnd.cpp
  • XProgressWnd.h

Next, include header file XProgressWnd.h in appropriate project files. Now you are ready to start using CXProgressWnd.

Example 1 - Using XProgressWnd within a single function

The file XProgressWndTestDlg.cpp gives an example:
CXProgressWnd wndProgress(this,
    _T("Progress"), (LPCTSTR)nAvi[m_nAvi], nAviHeight[m_nAvi]);

if (m_bModal)

wndProgress.SetRange(0, nRange[m_nRange])
           .SetText(_T("This is a progress window...\n\n")
                    _T("Try dragging it around, hitting Cancel or pressing ESC."));

for (int i = 0; i < nRange[m_nRange]; i++)
    if (i > (4000*(m_nRange+1)))
        // no flickering!
        wndProgress.SetText(_T("\nThis is step #%d"), i);

    if (wndProgress.Cancelled())
        AfxMessageBox(_T("Operation Canceled."));

Example 2 - Creating XProgressWnd in one function, and using it in another

You can create the XProgressWnd in one part of your program, and use it in another, by declaring a class member variable:
CXProgressWnd *m_pwndProgress;
To create the XProgressWnd:
m_pwndProgress = new CXProgressWnd(this, _T("Progress"),
    (LPCTSTR)nAvi[m_nAvi], nAviHeight[m_nAvi]);

if (m_bModal)

m_pwndProgress->SetRange(0, nRange[m_nRange]);
m_pwndProgress->SetText(_T("This is a progress window...\n\n")
                        _T("Try dragging it around, hitting Cancel or pressing ESC."));
and then you can use it in another function like this:
for (int i = 0; i < nRange[m_nRange]; i++)
    if (i > (4000*(m_nRange+1)))
        // no flickering!
        m_pwndProgress->SetText(_T("\nThis is step #%d"), i);

    if (m_pwndProgress->Cancelled())
        AfxMessageBox(_T("Operation Canceled."));
When you finish with it, don't forget to delete it:
delete m_pwndProgress;

Revision History

Version 2.0 - 2008 November 3

  • Initial public release.


This software is released into the public domain. You are free to use it in any way you like, except that you may not sell this source code. If you modify it or extend it, please to consider posting new code here for everyone to share. This software is provided "as is" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.


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


About the Author

Hans Dietrich
Software Developer (Senior) Hans Dietrich Software
United States United States
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.

Recently, I have moved to Los Angeles where I am doing consulting and development work.

For consulting and custom software development, please see

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
Joerg Hoffmann2-Aug-10 1:13
memberJoerg Hoffmann2-Aug-10 1:13 
QuestionProblem with small range Pin
Joerg Hoffmann28-Jul-10 5:53
memberJoerg Hoffmann28-Jul-10 5:53 
AnswerRe: Problem with small range Pin
Hans Dietrich28-Jul-10 6:51
mentorHans Dietrich28-Jul-10 6:51 
GeneralRe: Problem with small range Pin
Joerg Hoffmann28-Jul-10 12:24
memberJoerg Hoffmann28-Jul-10 12:24 
GeneralRe: Problem with small range Pin
Hans Dietrich29-Jul-10 3:41
mentorHans Dietrich29-Jul-10 3:41 
GeneralRe: Problem with small range Pin
Joerg Hoffmann1-Aug-10 22:30
memberJoerg Hoffmann1-Aug-10 22:30 
GeneralGreat Job! Pin
gegegegeda15-Jun-10 2:57
membergegegegeda15-Jun-10 2:57 
GeneralStack around the variable 'ncm' was corrupted Pin
Sonar17-Sep-09 11:42
memberSonar17-Sep-09 11:42 
GeneralRe: Stack around the variable 'ncm' was corrupted Pin
Hans Dietrich17-Sep-09 17:18
mentorHans Dietrich17-Sep-09 17:18 
GeneralSuper but... Pin
Keith Dennis9-Jan-09 4:37
memberKeith Dennis9-Jan-09 4:37 
GeneralPerfect Pin
Abhijit Jana12-Dec-08 4:19
mentorAbhijit Jana12-Dec-08 4:19 
GeneralWow! Pin
Paul Conrad10-Nov-08 19:34
professionalPaul Conrad10-Nov-08 19:34 
QuestionWho gave it a one? Pin
.dan.g.6-Nov-08 12:42
professional.dan.g.6-Nov-08 12:42 
AnswerRe: Who gave it a one? Pin
Hans Dietrich6-Nov-08 13:21
mentorHans Dietrich6-Nov-08 13:21 
GeneralRe: Who gave it a one? Pin
Hamed Mosavi9-Dec-08 5:39
memberHamed Mosavi9-Dec-08 5:39 
JokeRe: Who gave it a one? Pin
Emil - Gabriel12-Dec-08 5:20
memberEmil - Gabriel12-Dec-08 5:20 
AnswerRe: Who gave it a one? Pin
Paul Conrad10-Nov-08 19:35
professionalPaul Conrad10-Nov-08 19:35 
AnswerRe: Who gave it a one? Pin
Stefano Bettega11-Nov-08 2:35
professionalStefano Bettega11-Nov-08 2:35 
GeneralRe: Who gave it a one? Pin
Sabuncu7-Feb-09 5:12
memberSabuncu7-Feb-09 5:12 
GeneralLengthly operations Pin
Davide Zaccanti4-Nov-08 4:22
memberDavide Zaccanti4-Nov-08 4:22 
GeneralRe: Lengthly operations Pin
Hans Dietrich4-Nov-08 6:39
mentorHans Dietrich4-Nov-08 6:39 
GeneralRe: Lengthly operations Pin
Davide Zaccanti4-Nov-08 7:01
memberDavide Zaccanti4-Nov-08 7:01 
GeneralRe: Lengthly operations Pin
NGS 5496724-Nov-08 6:42
memberNGS 5496724-Nov-08 6:42 
GeneralRe: Lengthly operations Pin
Davide Zaccanti4-Nov-08 7:07
memberDavide Zaccanti4-Nov-08 7:07 
GeneralRe: Lengthly operations Pin
Joseph Mccornell11-Nov-08 6:16
memberJoseph Mccornell11-Nov-08 6:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

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

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.181215.1 | Last Updated 3 Nov 2008
Article Copyright 2008 by Hans Dietrich
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid