Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5833497
  • 博文数量: 671
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 7310
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 09:56
文章分类

全部博文(671)

文章存档

2011年(1)

2010年(2)

2009年(24)

2008年(271)

2007年(319)

2006年(54)

我的朋友

分类: C/C++

2007-04-26 14:52:50

  • [Version 1.0.2]

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

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.

Nautilus Master


Click to view Nautilus Master's online profile.

阅读(1640) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~