Click here to Skip to main content
15,881,709 members
Articles / Desktop Programming / MFC

Taskbar Progressbar Control

Rate me:
Please Sign up or sign in to vote.
4.14/5 (23 votes)
3 Apr 20072 min read 257K   3.9K   97   46
How to put a progressbar control into the taskbar.

Introduction

This article describes how to put a progress bar control into the taskbar.

Sample screenshot

Sample screenshot

How Does It Work?

First, we need to create an instance of the progress control. The progress bar control will be automatically attached to the taskbar. At startup, the program searches for three specific HWnds. These are Shell_TrayWnd, ReBarWindow32 and TrayNotifyWnd. The program tasks, shortcut bar, etc. are all included into this window using the ReBarWindow32 class. ReBarWindow32 is directly placed beside the TrayNotifyWnd window. All we need to do now is to create the progress bar using the method Create but we don't add it to our main window, we add it to the taskbar. An important fact is that the control needs its own message map, else you will get a 100% CPU usage due to the message handling when we click on the control in the taskbar.

Facts

  • The progress control is directly attached into the taskbar. When you have enabled the Auto Hide option of the Windows Taskbar, the control moves with it.
  • We need to renew the control when we:
    • Add an icon into the tray notify bar.
    • Change/move the taskbar from horizontal to vertical and vice versa.
    • * etc..
  • To renew the control, we need a timer at this time (I haven't found a kind of broadcast message yet).
  • Parent window of the control is the Shell_TrayWnd of the Taskbar.

Other Classes Used

  • CTextProgressCtrl by Chris Maunder

Where Does It Work?

It's tested on:

  • WinXP
  • Win2000 Prof
  • Win2003 Server

Use this program / source code at your own risk. The author of this program is not responsible for any damage on your or another computer caused by this program.

License

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.


Written By
Austria Austria
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionGreat Article Pin
Аslam Iqbal5-Nov-16 23:45
professionalАslam Iqbal5-Nov-16 23:45 
QuestionControl is transparent in Vista. How to make it non transparent? Pin
dima polyakov5-May-07 14:48
dima polyakov5-May-07 14:48 
AnswerRe: Control is transparent in Vista. How to make it non transparent? Pin
dima polyakov6-May-07 7:48
dima polyakov6-May-07 7:48 
Generaldisplay progress bar Pin
anu jaggi24-Apr-07 23:21
anu jaggi24-Apr-07 23:21 
GeneralUPDATE: TTaskbarContainer [modified] Pin
Nautilus Master31-Mar-07 9:03
Nautilus Master31-Mar-07 9:03 
GeneralBug in NProgressBar.cpp with m_bCreated Pin
Port233227-Feb-07 3:24
Port233227-Feb-07 3:24 
GeneralRe: Bug in NProgressBar.cpp with m_bCreated Pin
Nautilus Master27-Feb-07 7:25
Nautilus Master27-Feb-07 7:25 
Generalneed a C# version Pin
goldli24-Feb-07 15:16
goldli24-Feb-07 15:16 
GeneralRe: need a C# version Pin
Nautilus Master2-Mar-07 7:43
Nautilus Master2-Mar-07 7:43 
GeneralRe: need a C# version Pin
quin5815-Mar-10 20:13
quin5815-Mar-10 20:13 
Generalseparate TaskBarHandling & ProgressCtrl Pin
JimmyO17-Jan-07 14:01
JimmyO17-Jan-07 14:01 
GeneralVersion 1.0.2 well uploaded [modified] Pin
Nautilus Master24-Jul-06 9:02
Nautilus Master24-Jul-06 9:02 
GeneralRe: Version 1.0.2 well uploaded Pin
Defenestration24-Jul-06 11:25
Defenestration24-Jul-06 11:25 
QuestionNeed Soucre in VB net 2003 Pin
jur1sa21-Jul-06 16:50
jur1sa21-Jul-06 16:50 
AnswerRe: Need Soucre in VB net 2003 Pin
Nautilus Master24-Jul-06 7:30
Nautilus Master24-Jul-06 7:30 
GeneralProblem with double line TaskBar Pin
zerolan2220-Jul-06 1:19
zerolan2220-Jul-06 1:19 
GeneralRe: Problem with double line TaskBar [modified] Pin
Nautilus Master21-Jul-06 6:54
Nautilus Master21-Jul-06 6:54 
GeneralRe: Problem with double line TaskBar Pin
zerolan2224-Jul-06 1:51
zerolan2224-Jul-06 1:51 
Generalwell done Pin
Nautilus Master24-Jul-06 9:04
Nautilus Master24-Jul-06 9:04 
GeneralRe: well done Pin
zerolan2225-Jul-06 5:27
zerolan2225-Jul-06 5:27 
GeneralThe application doesn't run correctly on windows2000 server Pin
Gavin Yuan13-Feb-06 20:46
Gavin Yuan13-Feb-06 20:46 
GeneralRe: The application doesn't run correctly on windows2000 server Pin
Nautilus Master27-Feb-06 23:39
Nautilus Master27-Feb-06 23:39 
Generaladd exe demo :-) Pin
am0n_66629-Oct-05 22:45
am0n_66629-Oct-05 22:45 
GeneralNeeds to be reworked and optimized further. Pin
WREY29-Oct-05 19:26
WREY29-Oct-05 19:26 
GeneralRe: Needs to be reworked and optimized further. Pin
Nautilus Master30-Oct-05 1:51
Nautilus Master30-Oct-05 1:51 

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.