Click here to Skip to main content
15,886,199 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 257.1K   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

 
AnswerRe: C# Version? Pin
P.J. van de Sande24-Jul-06 21:41
P.J. van de Sande24-Jul-06 21:41 
GeneralRe: C# Version? Pin
jsamper15-Aug-06 12:07
jsamper15-Aug-06 12:07 
AnswerRe: C# Version? [modified] Pin
P.J. van de Sande15-Aug-06 20:59
P.J. van de Sande15-Aug-06 20:59 
QuestionRe: C# Version? Pin
trutchet23-Aug-06 4:56
trutchet23-Aug-06 4:56 
AnswerRe: C# Version? Pin
stephnagel24-Aug-06 4:54
stephnagel24-Aug-06 4:54 
GeneralRe: C# Version? [modified] Pin
Nautilus Master26-Aug-06 7:05
Nautilus Master26-Aug-06 7:05 
GeneralRe: C# Version? Pin
trutchet28-Aug-06 21:59
trutchet28-Aug-06 21:59 
GeneralRe: C# Version? Pin
vl950t26-Sep-06 7:26
vl950t26-Sep-06 7:26 
Hi,

I am also interested in the C# version. Could you please send me
an example?

Cheers,
Franz

GeneralUpdate 17.10.2005 Pin
Nautilus Master16-Oct-05 20:07
Nautilus Master16-Oct-05 20:07 
GeneralRe: Update 17.10.2005 Pin
ThatsAlok17-Oct-05 18:45
ThatsAlok17-Oct-05 18:45 
Generalthis code is terrible Pin
AlejandroDG15-Oct-05 15:03
AlejandroDG15-Oct-05 15:03 
GeneralCorrections well done Pin
Nautilus Master16-Oct-05 20:08
Nautilus Master16-Oct-05 20:08 
GeneralNice demo really Pin
ddmcr15-Oct-05 3:19
ddmcr15-Oct-05 3:19 
GeneralRe: Nice demo really Pin
Nautilus Master15-Oct-05 3:58
Nautilus Master15-Oct-05 3:58 
GeneralRe: Nice demo really Pin
ddmcr15-Oct-05 22:21
ddmcr15-Oct-05 22:21 
GeneralLooks promising... Pin
The_Mega_ZZTer14-Oct-05 18:14
The_Mega_ZZTer14-Oct-05 18:14 
GeneralVersion 1.0 Pin
Nautilus Master14-Oct-05 12:19
Nautilus Master14-Oct-05 12:19 

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.