Page 1 of 1

Show progress bar progress on windows Taskbar (Win7 Only) Exactly like it's done in Windows explorer copying files Rate Topic: ***** 1 Votes

#1 krismania  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 148
  • Joined: 03-January 10

Posted 20 March 2010 - 09:08 AM

*
POPULAR

I'me sure anyone who has windows 7 has noticed the fantastic new taskbar that looks like a giant quick launch bar from previous windows. it blew me away at first because of the new features they introduced. The feature that we will be using today is the display of a progress bar on the taskbar icon. that is:

Posted Image

Notice in the image behind the explorer icon, there is a green progress bar, which is a clone of the actual one. Today we will make one of these for our own programs.

First of all, you will need the Windows API to even think about using such features of windows 7. you can download it free Here

Once you have that, we can start coding! :D


Open up Visual Studio and create a new project. we will call ours taskbarProgress.

Posted Image

In order to use our new API, we need to tell VS where it is. Do this by:
going to the my project page
clicking the refrences tab
clicking add
clicking on the browse tab
locating Microsoft.WindowsAPICodePack.Shell.dll (should be in WindowsAPICodePack\Shell\bin\Debug\ from where you extracted the API)

Posted Image


Now we design the form. Mine will be very simple:

Posted Image

Just a Trackbar and a Progressbar. I also changed the title, made the form un-resisable and disabled the maximise button, but none of that's important.

Now for coding. Double click the trackbar to create a Trackbar_Scroll Event.

At the top you will need to add this code:

Imports Microsoft.WindowsAPICodePack
Imports Microsoft.WindowsAPICodePack.Taskbar

so we can use the API

in the Trackbar_Scroll Event add the folowing code:

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        ProgressBar1.Value = TrackBar1.Value * 10
    End Sub


all this does is update the progress bar to follow the trackbar.

Now we will update our little progressbar clone on the taskbar to match the real progressbar.
We will add this to the TrackBar1_Scroll event.

TaskbarManager.Instance.SetProgressValue(TrackBar1.Value * 10, 100)


And that's it. Easy, huh? ;) this simply sets the value of the taskbar mini-progressbar.
8 lines of code and were done.

Posted Image

Because it's so simple, it's easy to integrate into all of your projects. but don't stop here. the windows API opens a whole new... Window of opportunities for you to make you program much better. I hope I make you realise what you can do with this API :D

Thank you for reading my tutorial! I hope it was helpful! leave a comment on what you thought and where I could Improve! Thanks again!!

Complete code:
Imports Microsoft.WindowsAPICodePack
Imports Microsoft.WindowsAPICodePack.Taskbar
Public Class Form1
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        ProgressBar1.Value = TrackBar1.Value * 10
        TaskbarManager.Instance.SetProgressValue(TrackBar1.Value * 10, 100)
    End Sub
End Class


Is This A Good Question/Topic? 7
  • +

Replies To: Show progress bar progress on windows Taskbar (Win7 Only)

#2 pepsip77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-April 10

Posted 14 April 2010 - 08:17 AM

thanks it's helped alot
Was This Post Helpful? 0
  • +
  • -

#3 krismania  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 148
  • Joined: 03-January 10

Posted 15 April 2010 - 12:44 AM

Glad I could help :D
Was This Post Helpful? 0
  • +
  • -

#4 biggerB  Icon User is offline

  • If at first you don’t succeed, call it version 1.0
  • member icon

Reputation: 80
  • View blog
  • Posts: 760
  • Joined: 11-June 10

Posted 22 June 2010 - 11:07 AM

Hello.
I really wanted to give my software the advantage of this feature but i downloaded the Windows Api and spent 2 hours trying to locate the above mentioned dll with no luck. I was wondering if you could post the dll as an attachment here it would be much appreciated.
Thanks.
Was This Post Helpful? 0
  • +
  • -

#5 krismania  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 148
  • Joined: 03-January 10

Posted 22 June 2010 - 02:59 PM

View PostbiggerB, on 23 June 2010 - 03:07 AM, said:

Hello.
I really wanted to give my software the advantage of this feature but i downloaded the Windows Api and spent 2 hours trying to locate the above mentioned dll with no luck. I was wondering if you could post the dll as an attachment here it would be much appreciated.
Thanks.


hmm thats odd... the path to it should be WindowsAPICodePack\Shell\bin\Debug\. are you strating from the main folder you downloaded called WindowsAPICodePack?
Was This Post Helpful? 0
  • +
  • -

#6 e2b  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 15-January 10

Posted 28 July 2010 - 08:24 AM

View Postkrismania, on 22 June 2010 - 01:59 PM, said:

View PostbiggerB, on 23 June 2010 - 03:07 AM, said:

Hello.
I really wanted to give my software the advantage of this feature but i downloaded the Windows Api and spent 2 hours trying to locate the above mentioned dll with no luck. I was wondering if you could post the dll as an attachment here it would be much appreciated.
Thanks.


hmm thats odd... the path to it should be WindowsAPICodePack\Shell\bin\Debug\. are you strating from the main folder you downloaded called WindowsAPICodePack?


Hello,
I am having the same problem. I clicked your link, downloaded all 4 files for "Windows API Code Pack 1.0.1" and saved them in my VS 2010 folder, and extracted the files for "WindowsAPICodePack.zip" into the same folder (...\Documents\Visual Studio 2010).

I checked most of the folders and they all contain classes in C#, and not VB.NET. Although, I am not sure if that matters or not. Checked in "...\WindowsAPICodePack\Shell", and saw no "bin" folder.

Still trying to figure it out though. :D
Was This Post Helpful? 0
  • +
  • -

#7 e2b  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 15-January 10

Posted 28 July 2010 - 08:57 AM

View Poste2b, on 28 July 2010 - 07:24 AM, said:

View Postkrismania, on 22 June 2010 - 01:59 PM, said:

View PostbiggerB, on 23 June 2010 - 03:07 AM, said:

Hello.
I really wanted to give my software the advantage of this feature but i downloaded the Windows Api and spent 2 hours trying to locate the above mentioned dll with no luck. I was wondering if you could post the dll as an attachment here it would be much appreciated.
Thanks.


hmm thats odd... the path to it should be WindowsAPICodePack\Shell\bin\Debug\. are you strating from the main folder you downloaded called WindowsAPICodePack?


Hello,
I am having the same problem. I clicked your link, downloaded all 4 files for "Windows API Code Pack 1.0.1" and saved them in my VS 2010 folder, and extracted the files for "WindowsAPICodePack.zip" into the same folder (...\Documents\Visual Studio 2010).

I checked most of the folders and they all contain classes in C#, and not VB.NET. Although, I am not sure if that matters or not. Checked in "...\WindowsAPICodePack\Shell", and saw no "bin" folder.

Still trying to figure it out though. :D


Okay, I just got it working. I didn't know that first you have to compile the WindowsAPICodePack.sln.

If you click the home tab on the msdn site where you downloaded the API, and scroll down towards the bottom, you might notice a short tutorial to build and use the library... "To build the library (except the DirectX related features) in Visual Studio 2008, please extract the contents of the ‘WindowsAPICodePack.zip’ file in a new folder and build the included ‘WindowsAPICodePack.sln’ file."

After the code compiled, I checked the "...\WindowsAPICodePack\Shell" directory again, and the bin folder was added.

Thanks for the tutorial.
Was This Post Helpful? 0
  • +
  • -

#8 Guest_BehrOOz*


Reputation:

Posted 29 July 2010 - 09:21 PM

hi , thank you for share this tutorial , i looking for something like that but it don't work in my project visual stedio vb.net 2010 , how can find sample of this for VS 2010 ?
Was This Post Helpful? 0

#9 krismania  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 148
  • Joined: 03-January 10

Posted 30 July 2010 - 07:07 AM

View PostBehrOOz, on 30 July 2010 - 01:21 PM, said:

hi , thank you for share this tutorial , i looking for something like that but it don't work in my project visual stedio vb.net 2010 , how can find sample of this for VS 2010 ?


You should be able to find a sample of this and other features of the API in the download. I think you can open them up in visual studio.
Was This Post Helpful? 0
  • +
  • -

#10 RobboD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-September 12

Posted 25 September 2012 - 11:24 AM

View Postkrismania, on 15 April 2010 - 12:44 AM, said:

Glad I could help :D


Hi,

Thanks for your help. I managed to make your example but I had a bit of trouble getting started. I did not realise that you have to use VS C# to build the dll. (I normally use VB.NET). I also had to add a reference to System.Xaml.dll manually in the C# project. (I found it here: C:\Windows\Microsoft.NET\Framework\v4.0.30319)

I now have a problem. I have added a second form to the project exactly like the first. The first form now contains only a button to open the second form. If you open the second form using the button on the first form, the code functions correctly in the second form, exactly as it did when there was only one form. However, if you close the second form and then reopen it, the progress bar in the taskbar no longer appears when the trackbar is moved!

I was hoping to use the progress bar in the taskbar icon to represent downloading/uploading progress in an app I am making but if it only works once when called from a secondary form I'm stuck! Have you any idea how to solve the problem, please?
Was This Post Helpful? 0
  • +
  • -

#11 RobboD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-September 12

Posted 25 September 2012 - 11:52 AM

[quote name='RobboD' date='25 September 2012 - 11:24 AM' timestamp='1348597464' post='1709318']
[quote name='krismania' date='15 April 2010 - 12:44 AM' timestamp='1271317444' post='990290']
Glad I could help :D

PS.

I have just discovered that the behaviour I described in my previous post seems to be random. Sometimes closing and reopening the second form is not a problem. At other times, it is! (About 50% of the time.) You may not be able to reproduce the bug. It may be my system. Should something be reset or disposed when a form is closed maybe?
Was This Post Helpful? 0
  • +
  • -

#12 krismania  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 148
  • Joined: 03-January 10

Posted 25 September 2012 - 06:36 PM

[quote name='RobboD' date='26 September 2012 - 05:52 AM' timestamp='1348599158' post='1709345']
[quote name='RobboD' date='25 September 2012 - 11:24 AM' timestamp='1348597464' post='1709318']

View Postkrismania, on 15 April 2010 - 12:44 AM, said:

Glad I could help :D

PS.

I have just discovered that the behaviour I described in my previous post seems to be random. Sometimes closing and reopening the second form is not a problem. At other times, it is! (About 50% of the time.) You may not be able to reproduce the bug. It may be my system. Should something be reset or disposed when a form is closed maybe?


Wow, it's been a while since I've been here!

I'm sorry to say that I've just about forgotten everything that I knew about VB since I posted this tutorial, and really can't be of any help.

I suggest you start a new thread about the problem and see if someone else who actually has a clue can help you. Feel free to refer to my tutorial or use information from it.

Once again, I am sorry I can't help. Good luck :D
Was This Post Helpful? 0
  • +
  • -

#13 RobboD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-September 12

Posted 26 September 2012 - 04:45 AM

[/quote]
Wow, it's been a while since I've been here!

I'm sorry to say that I've just about forgotten everything that I knew about VB since I posted this tutorial, and really can't be of any help.

I suggest you start a new thread about the problem and see if someone else who actually has a clue can help you. Feel free to refer to my tutorial or use information from it.

Once again, I am sorry I can't help. Good luck :D
[/quote]

Thanks for reply. I have asked for help here: http://social.msdn.m...15-9c4ee6bccb17

Thanks for reply. I've posted this:

http://social.msdn.m...15-9c4ee6bccb17
Was This Post Helpful? 0
  • +
  • -

#14 Legjendat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-November 10

Posted 06 March 2013 - 05:20 AM

View Postkrismania, on 20 March 2010 - 09:08 AM, said:

I'me sure anyone who has windows 7 has noticed the fantastic new taskbar that looks like a giant quick launch bar from previous windows. it blew me away at first because of the new features they introduced. The feature that we will be using today is the display of a progress bar on the taskbar icon. that is:

Posted Image

Notice in the image behind the explorer icon, there is a green progress bar, which is a clone of the actual one. Today we will make one of these for our own programs.

First of all, you will need the Windows API to even think about using such features of windows 7. you can download it free Here

Once you have that, we can start coding! :D/>


Open up Visual Studio and create a new project. we will call ours taskbarProgress.

Posted Image

In order to use our new API, we need to tell VS where it is. Do this by:
going to the my project page
clicking the refrences tab
clicking add
clicking on the browse tab
locating Microsoft.WindowsAPICodePack.Shell.dll (should be in WindowsAPICodePack\Shell\bin\Debug\ from where you extracted the API)

Posted Image


Now we design the form. Mine will be very simple:

Posted Image

Just a Trackbar and a Progressbar. I also changed the title, made the form un-resisable and disabled the maximise button, but none of that's important.

Now for coding. Double click the trackbar to create a Trackbar_Scroll Event.

At the top you will need to add this code:

Imports Microsoft.WindowsAPICodePack
Imports Microsoft.WindowsAPICodePack.Taskbar

so we can use the API

in the Trackbar_Scroll Event add the folowing code:

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        ProgressBar1.Value = TrackBar1.Value * 10
    End Sub


all this does is update the progress bar to follow the trackbar.

Now we will update our little progressbar clone on the taskbar to match the real progressbar.
We will add this to the TrackBar1_Scroll event.

TaskbarManager.Instance.SetProgressValue(TrackBar1.Value * 10, 100)


And that's it. Easy, huh? ;)/> this simply sets the value of the taskbar mini-progressbar.
8 lines of code and were done.

Posted Image

Because it's so simple, it's easy to integrate into all of your projects. but don't stop here. the windows API opens a whole new... Window of opportunities for you to make you program much better. I hope I make you realise what you can do with this API :D/>

Thank you for reading my tutorial! I hope it was helpful! leave a comment on what you thought and where I could Improve! Thanks again!!

Complete code:
Imports Microsoft.WindowsAPICodePack
Imports Microsoft.WindowsAPICodePack.Taskbar
Public Class Form1
    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        ProgressBar1.Value = TrackBar1.Value * 10
        TaskbarManager.Instance.SetProgressValue(TrackBar1.Value * 10, 100)
    End Sub
End Class



I have made an application with the FormBorderStyle property set to fixed single, and have made my own icons for minimize/maximize/exit. My problem is that when I click minimize, no minimizing animation is shown like with other problems, can this api help me get that animation back?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1