Sep
14
2009

Windows API Code Pack – Progress Bar

Yesterday, I wrote about the Windows API Code Pack, and how you can add icon overlay support to your application. Another feature that the API gives you is the ability to add a progress bar to the taskbar. It is similar to icon overlays in that it changes the appearance of your icon, but only slightly. Instead of overlaying something on top of the application icon, it turns the background into a progress bar.

using Microsoft.WindowsAPICodePack.Taskbar; 
private void LongRunningProcess() 
{ 
    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal); 
    for (int i = 0; i < 100; i++) 
    { 
        TaskbarManager.Instance.SetProgressValue(i, 99); 
        Thread.Sleep(100); 
    } 
    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress); 
} 

There is support for other states your application could be in as well.
TaskbarProgressBarState.Indeterminate – puts the progress bar in “marquee” mode
TaskbarProgressBarState.Paused – causes the background to glow yellow
TaskbarProgressBarState.Error – causes the background to glow red

Comments (1) -

visage

excellent.
great article you made. I feel enjoy while reading your article.

thanks

Add comment




biuquote
Loading


AdSense

Software engineer by hobby and trade. When I am not sitting in front of a computer, you can find me playing with my kids. I am lucky enough to be married to my best friend and high school sweetheart. Life couldn't be better!

 

All content is mine, not my employers

Chronology

Tweets

what is the easiest way to *just* the last changeset number from git?
21 hours ago via Silver Bird
@ParasValecha so it is a virus some marketing guy manage to win an award for? ;)
3 days ago via Silver Bird
@ParasValecha none. I think they are one of the worse "viruses" you can get. Thrashing your disk and hogging CPU any chance they get
3 days ago via Silver Bird
...i have gone 5 years without one and been fine
3 days ago via Microsoft
... and provide little value on a day to day basis. Don't go to random content, and don't open stuff you don't understand...
3 days ago via Microsoft
I wholeheartedly believe that virus scanners are one of the worst things to install. they really slow down your computer...
3 days ago via Microsoft
RT @CodeWisdom: "When your hammer is C++, everything begins to look like a thumb." - Steve Haflich #fb
5 days ago via rowi for Windows Phone
Follow me on Twitter