Results 1 to 33 of 33

Thread: [VB6] Win7 Taskbar Features with ITaskbarList3 (overlay, progress in taskbar, etc)

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,653

    [VB6] Win7 Taskbar Features with ITaskbarList3 : overlay, progress in taskbar, etc

    ITaskbarList Demo
    Name:  Y03UgMq.jpg
Views: 91
Size:  24.5 KB

    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.

    Project Update
    Updated the TLB reference to point to oleexp.tlb v4.0 or higher.

    Project Update
    Project updated to fix minor bug where tooltips for custom buttons did not display.

    Requirements
    -Only works on Windows 7 and above.
    -This project uses oleexp.tlb, my Modern Shell Interfaces expansion of Edanmo's olelib.tlb. Always use the latest version from that thread, it's no longer included in the ZIP of my projects so that 6 different versions aren't around all at once. Once you've extracted everything, in the sample project, go to References and update the path. If you already work with olelib, oleexp replaces it. 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. *This project now references oleexp.tlb v4.0 or higher*


    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
    From there you can begin calling its functions, most of which are very straightforward:
    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]
    The only thing a little complicated is the buttons.

    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)
        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.


    twinBASIC 64bit compatible version at https://github.com/fafalone/MiscDemos
    Attached Files Attached Files
    Last edited by fafalone; Feb 28th, 2026 at 01:45 PM. Reason: Fix image

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width