ITaskbarList Demo
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Windows 7 introduced the ITaskbarList3 and ITaskbarList4 interfaces that added a number of new features to the taskbar for your program. The most commonly seen is the ability to turn the taskbar into a progress bar, and there's also the ability to add an overlay icon, add buttons below the thumbnail, and change the area the thumbnail covers among others. Like many other shell interfaces, it's available to VB either through type libraries or by directly calling the vtable. I prefer the former approach since many times internal structures and interfaces have far wider uses, so they can be put in the TLB and be accessible everywhere, not just within a class.
This project uses oleexp.tlb, my Modern Shell Interfaces expansion of Edanmo's olelib.tlb. The latest version is included in the ZIP; once you've extracted everything, in the sample project, go to References and update the paths. If you already work with olelib, the included olelib.tlb is a higher version that should replace that one. There's a few minor changes, but nothing major- just a few things moved to oleexp and 3 interfaces had some of their subs turned into functions. See the oleexp thread in the link above for complete details. If you're already using oleexp.tlb, make sure you have at least the version included here (dated 1/18/15).
Using ITaskbarList
Usage is fairly simple; you generally want to use it as a module level variable in your main form;
Code:
Private iTBL As TaskbarList
'...then in form_load:
Set iTBL = New TaskbarList
Code:
iTBL.SetOverlayIcon Me.hWnd, hIcoOvr, "Overlay icon active."
iTBL.SetProgressState Me.hWnd, TBPF_INDETERMINATE 'marquee
iTBL.SetThumbnailTooltip Me.hWnd, Text1.Text
iTBL.SetThumbnailClip Me.hWnd, [rect]
Code:
Dim pButtons() As THUMBBUTTON
ReDim pButtons(2) 'basic 3-button setup
arIcon(0) = ResIconToHICON("ICO_LEFT", 32, 32)
arIcon(1) = ResIconToHICON("ICO_UP", 32, 32)
arIcon(2) = ResIconToHICON("ICO_RIGHT", 32, 32)
Call SubClass(Me.hWnd, AddressOf F1WndProc)
With pButtons(0)
.dwMask = THB_FLAGS Or THB_TOOLTIP Or THB_ICON
.iid = 100
.dwFlags = THBF_ENABLED
Call Str2Inta("Stop", pInt)
For i = 0 To 259
.szTip(i) = pInt(i) 'this doesn't seem to be working... will address in a future release
Next i
.hIcon = arIcon(0)
End With
[fill in the other buttons]
iTBL.ThumbBarAddButtons Me.hWnd, 3, VarPtr(pButtons(0))
Icons
The TaskbarList interface deals with hIcons; in the sample project, they're stored in a resource file and loaded from there, but you could load them from anywhere with any method that will give you a valid hIcon.
Subclassing
The only thing that requires subclassing is receiving notification when a user clicks on a button below the thumbnail. If you're not going to be using that feature, then you won't need to subclass. The sample project does include a very simple subclassing module that receives the WM_COMMAND message that's sent when a button is clicked, and passes the ID of the button (the LoWord of the wParam) back to the main form.