Results 1 to 3 of 3

Thread: TaskbarButton Progress

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    TaskbarButton Progress

    Lightweight, no typelib used just DispCallFunc() hacking.

    Requires Windows 7 or later, but the manifest is optional. Works in the IDE but uses subclassing so be cautious.

    Demo client Form included:

    Code:
    Option Explicit
    
    Private Const PROG_TOTAL As Long = 500
    
    Private ProgCompleted As Long
    Private WithEvents TaskbarList3 As TaskbarList3
    
    Private Sub Command1_Click()
        TaskbarList3.SetProgressState TBPF_NORMAL
        Command1.Enabled = False
        Timer1.Enabled = True
    End Sub
    
    Private Sub Form_Initialize()
        'Could also do this in a Form_Load event handler instead:
        Set TaskbarList3 = New TaskbarList3
        TaskbarList3.ConnectFormToShell32 Me
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        'Redundant since we are unloading anyway.  But normally you'd do this once
        'the action's indicated progress has completed, so we'll show it here:
        With TaskbarList3
            If .Connected Then .SetProgressState TBPF_NOPROGRESS
        End With
    End Sub
    
    Private Sub TaskbarList3_Connected()
        Command1.Enabled = True
    End Sub
    
    Private Sub Timer1_Timer()
        With TaskbarList3
            If .Connected Then 'Redundant test here, because to get here the Connected
                               'event has been raised so that Command1 got enabled so that
                               'the user could have pressed it so that Timer1 got enabled.
                ProgCompleted = ProgCompleted + 1
                If ProgCompleted > PROG_TOTAL Then ProgCompleted = 0
                .SetProgressValue ProgCompleted, PROG_TOTAL
            End If
        End With
    End Sub
    Run the demo. Click on Start and watch the Taskbar button. Even works minimized.

    You can pause it or mark it "error" and so on as well.
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: TaskbarButton Progress

    Very good work.
    Leandro also did the same.
    in case you want to add more options such as buttons.
    here you have the zip in # 9 link.
    https://www.vbforums.com/showthread....barList-No-tlb

    a doubt some easy way to get all the guisid for example.
    Code:
    Private Const CLSID_TaskbarList As String = "{56FDF344-FD6D-11d0-958A-006097C9A090}"
    always with idl files, there is some gui viewer.

    a greeting

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: TaskbarButton Progress

    Thanks. I hadn't read all of that thread before.

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