Support Forums
[VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] (/showthread.php?tid=19257)



[VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] - The-One - 06-03-2011

Hey,

So I found Microsoft.WindowsAPICodePack.dll online and I started screwing with it. I found that you can add ThumbnailToolbarButtons to your process, just like WMP has.

This is what we are aiming for:

[Image: 1306067083-330.png]

The .dll's: http://www.multiupload.com/FDKNSPL53Y

Okay i'm not going to tell every basic crap, I assume you know something about VB before doing this.

Step 1
Add the .dll's as reference.

Step 2
Import the following element: Microsoft.WindowsAPICodePack.Taskbar

Step 3
Declare the buttons you want, I did three(to show you guys how to add more then one button with only ONE line).

Code:
Dim WithEvents ttb_1 As New ThumbnailToolbarButton(Me.Icon, "Black Background")
    Dim WithEvents ttb_2 As New ThumbnailToolbarButton(Me.Icon, "White Background")
    Dim WithEvents ttb_3 As New ThumbnailToolbarButton(Me.Icon, "MessageBox")

Step 4
Next, add the code which will add the buttons:

Code:
Dim arr(0 To 2) As ThumbnailToolbarButton
  arr(0) = ttb_1
  arr(1) = ttb_2
  arr(2) = ttb_3
  TaskbarManager.Instance.ThumbnailToolbars.AddButtons(Me.Handle, arr)

This will add all three buttons to your application, but now, how can we make it execute something on a click?

Step 5

Add this code:

Code:
Sub ttb_1_click() Handles ttb_1.Click

    End Sub

If change:

Code:
Handles ttb_1.Click

to

Code:
Handles ttb_2.Click

It will execute only when the 2nd button is clicked.
Now you can add your code.

Enjoy Pirate



RE: [VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] - KoBE - 06-03-2011

Looks pretty cool. Thanks for sharing.


RE: [VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] - The-One - 06-04-2011

(06-03-2011, 10:38 AM)KoBE Wrote: Looks pretty cool. Thanks for sharing.

No problem man, thanks for replying.


RE: [VB.Net] Adding ThumbnailToolbarButtons to your application [Win7] - Inventor - 06-04-2011

Rather nice, thanks!

Inventor1