Jump to content

ITaskbarList4 interface


 Share

Recommended Posts

Here is an attempt to approximate the ITaskbarList3 interface, which was quite a headache for me, since all C++ is new to me
https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/shell/taskbar-extensions.md
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist3

The code may have omissions or excesses, as for the writing where I was stuck and did not understand asking the AI

So if someone more experienced has any tips, I'd be happy to hear them

everything takes place in the taskbar thumbnail,  is displayed when the mouse pointer get over the taskbar icon


I put it as a UDF in a separate file so that the main script is cleaner

 

Example.au3

; https://www.autoitscript.com/forum/topic/212223-itaskbarlist4-interface/?do=edit
;----------------------------------------------------------------------------------------
; Title...........: Example.au3
; Description.....: Example howto use ITaskbarList3 interface
; AutoIt Version..: 3.3.16.1   Author: ioa747  Script Version: 0.0.0.3
; Note............: Testet in Win10 22H2
;----------------------------------------------------------------------------------------

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

#include "TaskbarList.au3" ; * <--

Global $bRedyflag = False

; Register to receive the message that our button is ready
GUIRegisterMsg(_WinAPI_RegisterWindowMessage("TaskbarButtonCreated"), "_TaskbarReady")

; Create a sample GUI window
Global $hGUI = GUICreate("ITaskbarList Example", 330, 200)
Global $idIcon = GUICtrlCreateIcon(@ScriptDir & "\Res\imageres-81.ico", -1, 200, 5, 128, 128)
Global $idButton = GUICtrlCreateButton("Click Me", 10, 10)
Global $ImageList1 = _GUIImageList_Create(32, 32, 5)
_GUIImageList_AddIcon($ImageList1, @ScriptDir & "\Res\prev.ico", 0, True)
_GUIImageList_AddIcon($ImageList1, @ScriptDir & "\Res\play.ico", 0, True)
_GUIImageList_AddIcon($ImageList1, @ScriptDir & "\Res\stop.ico", 0, True)
_GUIImageList_AddIcon($ImageList1, @ScriptDir & "\Res\next.ico", 0, True)
GUISetState(@SW_SHOW, $hGUI)

Global Enum $iTBtnPrev = 1000, $iTBtnPlay, $iTBtnStop, $iTBtnNext

; Register a handler for WM_COMMAND messages
GUIRegisterMsg($WM_COMMAND, "_OnThumbnailButtonClick")

; Add a button to the taskbar thumbnail toolbar
; dwMask, iId, iBitmap, hIcon, szTip, dwFlags
Global $dwMask = BitOR($THB_BITMAP, $THB_TOOLTIP, $THB_FLAGS)
Global $aTButtons[4][6] = [ _
        [$dwMask, $iTBtnPrev, 0, 0, "prev", 0], _
        [$dwMask, $iTBtnPlay, 1, 0, "play", 0], _
        [$dwMask, $iTBtnStop, 2, 0, "stop", 0], _
        [$dwMask, $iTBtnNext, 3, 0, "next", 0]]

While Not $bRedyflag
    Sleep(10)
WEnd

TB_ThumbBarSetImageList($hGUI, $ImageList1)
TB_ThumbBarAddButtons($hGUI, 4, $aTButtons)

; Selects a portion of a window's client area to display as that window's thumbnail in the taskbar.
TB_SetThumbnailClip($hGUI, 200, 0, 200 + 128, 128)

; Specifies or updates the text of the tooltip that is displayed when the mouse pointer rests on an individual preview thumbnail in a taskbar button flyout.
Local $sTxt = ""
$sTxt &= " Title...........: Example.au3" & @CRLF
$sTxt &= " Description.....: Example howto use ITaskbarList3 " & @CRLF
$sTxt &= " AutoIt Version..: 3.3.16.1    Script Version: 1.0"
TB_SetThumbnailTooltip($hGUI, $sTxt)

Global $hIcon
Global $iCnt = 0
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton
            ; Applies an overlay to a taskbar button to indicate application status or a notification to the user.
            $iCnt += 1
            ConsoleWrite("$iCnt=" & $iCnt & @CRLF)
            $hIcon = TB_GetIconHandle($iCnt > 10 ? @ScriptDir & "\Res\trffc14.ico" : @ScriptDir & "\Res\" & $iCnt & ".ico")
            TB_SetOverlayIcon($hGUI, $hIcon, String($iCnt))

    EndSwitch
WEnd

GUIDelete($hGUI)

;--------------------------------------------------------------------------------------------------------------------------------
; Function to handle the taskbar ready event
Func _TaskbarReady($hWnd, $msg, $wParam, $lParam)
    Switch $hWnd
        Case $hGUI
            ; The taskbar button is ready
            ConsoleWrite("--- Taskbar button ready ---" & @CRLF)
            $bRedyflag = True
    EndSwitch
EndFunc   ;==>_TaskbarReady

;--------------------------------------------------------------------------------------------------------------------------------
; Function to handle thumbnail button clicks
Func _OnThumbnailButtonClick($hWnd, $msg, $wParam, $lParam)
    ; Extract the button ID from the wParam
    Local $iButtonID = BitAND($wParam, 0xFFFF)

    Switch $iButtonID
        Case 1000  ; progress status in Thumbnail icon
            ConsoleWrite("- progress status in Thumbnail icon Button Clicked: " & $iButtonID & @CRLF)
            ; Load an icon
            $hIcon = TB_GetIconHandle(@ScriptDir & "\Res\comres-15.ico")
            TB_SetOverlayIcon($hGUI, $hIcon, "Wait")
            For $i = 1 To 100
                TB_SetProgress($hGUI, $i, 100)
                Sleep(25)
            Next
            TB_Flash($hGUI, 4, 300)
            $hIcon = TB_GetIconHandle($iCnt > 10 ? @ScriptDir & "\Res\trffc14.ico" : @ScriptDir & "\Res\" & $iCnt & ".ico")
            TB_SetOverlayIcon($hGUI, $hIcon, String($iCnt))

        Case 1001  ; Flash the taskbar icon RED
            ConsoleWrite("- Flash the taskbar icon RED  Button Clicked: " & $iButtonID & @CRLF)

            For $i = 1 To 4
                TB_SetProgressState($hGUI, 4)
                Sleep(300)
                TB_SetProgressState($hGUI, 0)
                Sleep(300)
            Next
            TB_SetProgressState($hGUI, 0)

            Sleep(1000)

            For $i = 1 To 4
                TB_SetProgressState($hGUI, 4)
                TB_SetProgress($hGUI, 100, 100)
                Sleep(300)
                TB_SetProgressState($hGUI, 0)
                TB_SetProgress($hGUI, 0, 100)
                Sleep(300)
            Next
            TB_SetProgressState($hGUI, 0)

        Case 1002  ; Flash the taskbar icon YELLOW
            ConsoleWrite("- Flash the taskbar icon YELLOW  Button Clicked: " & $iButtonID & @CRLF)

            For $i = 1 To 4
                TB_SetProgressState($hGUI, 8)
                Sleep(300)
                TB_SetProgressState($hGUI, 0)
                Sleep(300)
            Next
            TB_SetProgressState($hGUI, 0)

            Sleep(1000)

            For $i = 1 To 4
                TB_SetProgressState($hGUI, 8)
                TB_SetProgress($hGUI, 100, 100)
                Sleep(300)
                TB_SetProgressState($hGUI, 0)
                TB_SetProgress($hGUI, 0, 100)
                Sleep(300)
            Next
            TB_SetProgressState($hGUI, 0)

        Case 1003  ; progress status in Thumbnail icon
            ConsoleWrite("- progress status in Thumbnail icon Button Clicked: " & $iButtonID & @CRLF)
            ; Load an icon
            $hIcon = TB_GetIconHandle(@ScriptDir & "\Res\comres-15.ico")
            TB_SetOverlayIcon($hGUI, $hIcon, "Wait")
            For $i = 1 To 100
                Switch $i
                    Case 60 To 84
                        TB_SetProgressState($hGUI, 8) ;YELLOW
                    Case 85 To 100
                        TB_SetProgressState($hGUI, 4) ;RED
                EndSwitch
                TB_SetProgress($hGUI, $i, 100)
                Sleep(25)
            Next
            TB_Flash($hGUI, 4, 300)
            TB_SetProgressState($hGUI, 0)
            $hIcon = TB_GetIconHandle($iCnt > 10 ? @ScriptDir & "\Res\trffc14.ico" : @ScriptDir & "\Res\" & $iCnt & ".ico")
            TB_SetOverlayIcon($hGUI, $hIcon, String($iCnt))

    EndSwitch
EndFunc   ;==>_OnThumbnailButtonClick


 

TaskbarList.au3

#include-once
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=ITaskbarList4 interface
#AutoIt3Wrapper_Res_Fileversion=0.0.0.3
#AutoIt3Wrapper_Res_ProductName=TaskbarList.au3
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; https://www.autoitscript.com/forum/topic/212223-itaskbarlist4-interface
; https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/shell/taskbar-extensions.md
; https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-registertab
; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1536397
; Images must be 32-bit and of dimensions GetSystemMetrics(SM_CXICON) x GetSystemMetrics(SM_CYICON).

#include <WinAPISysWin.au3>
#include <GuiImageList.au3>

#Region ;**** CONSTANTS ****
; THUMBBUTTONFLAGS Used by THUMBBUTTON to control specific states and behaviors of the button.
Global Enum $THBF_ENABLED, $THBF_DISABLED, $THBF_DISMISSONCLICK, $THBF_NOBACKGROUND = 4, $THBF_HIDDEN = 8, $THBF_NONINTERACTIVE = 10

; THUMBBUTTONMASK Used by the THUMBBUTTON structure to specify which members of that structure contain valid data.
Global Enum $THB_BITMAP = 1, $THB_ICON, $THB_TOOLTIP = 4, $THB_FLAGS = 8

; Used by the ITaskbarList3::SetProgressState method to specify tab properties.
Global Enum $TBPF_NOPROGRESS, $TBPF_INDETERMINATE, $TBPF_NORMAL, $TBPF_ERROR = 4, $TBPF_PAUSED = 8

; Used by the ITaskbarList4::SetTabProperties method to specify tab properties.
Global Enum $STPF_NONE, $STPF_USEAPPTHUMBNAILALWAYS, $STPF_USEAPPTHUMBNAILWHENACTIVE, $STPF_USEAPPPEEKALWAYS = 4, $STPF_USEAPPPEEKWHENACTIVE = 8

Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" ; Win2000
Global Const $sIID_ITaskbarList2 = "{602D4995-B13A-429b-A66E-1935E44F4317}" ; WinXP
Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" ; Win7
Global Const $sIID_ITaskbarList4 = "{C43DC798-95D1-4BEA-9030-BB99E2983A1A}" ; Win7
Global Const $tagITaskbarList = _
        "HrInit hresult();" & _
        "AddTab hresult(hwnd);" & _
        "DeleteTab hresult(hwnd);" & _
        "ActivateTab hresult(hwnd);" & _
        "SetActiveAlt hresult(hwnd);"

Global Const $tagITaskbarList2 = $tagITaskbarList & _
        "MarkFullscreenWindow hresult(hwnd;boolean);"

Global Const $tagITaskbarList3 = $tagITaskbarList2 & _
        "SetProgressValue hresult(hwnd;uint64;uint64);" & _
        "SetProgressState hresult(hwnd;int);" & _
        "RegisterTab hresult(hwnd;hwnd);" & _
        "UnregisterTab hresult(hwnd);" & _
        "SetTabOrder hresult(hwnd;hwnd);" & _
        "SetTabActive hresult(hwnd;hwnd;dword);" & _
        "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _
        "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _
        "ThumbBarSetImageList hresult(hwnd;ptr);" & _
        "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _
        "SetThumbnailTooltip hresult(hwnd;wstr);" & _
        "SetThumbnailClip hresult(hwnd;ptr);"

Global Const $tagITaskbarList4 = $tagITaskbarList3 & _
        "SetTabProperties hresult(hwnd;int);"


; Used by methods of the ITaskbarList3 interface to define buttons used in a toolbar embedded in a window's thumbnail representation.
Global Const $tagTHUMBBUTTON = "dword dwMask;" & _
        "uint iId;" & _
        "uint iBitmap;" & _
        "handle hIcon;" & _
        "wchar szTip[260];" & _
        "dword dwFlags"
#EndRegion ;**** CONSTANTS ****

Global Const $g__oTB = __TB_Init()

; #INTERNAL_USE_ONLY# -----------------------------------------------------------------------------------------------------------
; Name...........: __TB_Init()
; Description....: Initializes the taskbar list object.
; Syntax.........: __TB_Init()
; Parameters.....: None.
; Return values..: $oTB, an object representing the taskbar list.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-hrinit
;--------------------------------------------------------------------------------------------------------------------------------
Func __TB_Init()
    Local $oTB = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $tagITaskbarList3)
    $oTB.HrInit()
    Return $oTB
EndFunc   ;==>__TB_Init

#Region ;**** ITaskbarList interface ****
; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_ActivateTab
; Description....: Activates an item on the taskbar. The window is not actually activated.
; Syntax.........: TB_ActivateTab($hWnd)
; Parameters.....: $hWnd - Handle to the tab control.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-activatetab
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_ActivateTab($hWnd)
    Return $g__oTB.ActivateTab($hWnd)
EndFunc   ;==>TB_ActivateTab

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_AddTab
; Description....: Adds a new tab to the taskbar.
; Syntax.........: TB_AddTab($hWnd)
; Parameters.....: $hWnd  - A handle to the window to be added to the taskbar.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-addtab
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_AddTab($hWnd)
    Return $g__oTB.AddTab($hWnd)
EndFunc   ;==>TB_AddTab

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_DeleteTab
; Description....: Deletes a tab from the taskbar.
; Syntax.........: DeleteTab($hWnd)
; Parameters.....: $hWnd - A handle to the window to be deleted from the taskbar.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-deletetab
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_DeleteTab($hWnd)
    Return $g__oTB.DeleteTab($hWnd)
EndFunc   ;==>TB_DeleteTab

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetActiveAlt
; Description....: Sets the active alternate for a toolbar control.
; Syntax.........: TB_SetActiveAlt($hWnd)
; Parameters.....: $hWnd - A handle to the window to be marked as active.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........: This function is only available on Windows Win2000 and later versions of the operating system.
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-setactivealt
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetActiveAlt($hWnd)
    Return $g__oTB.SetActiveAlt($hWnd)
EndFunc   ;==>TB_SetActiveAlt
#EndRegion ;**** ITaskbarList interface ****

#Region ;**** ITaskbarList2 interface ****
; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_MarkFullscreenWindow
; Description....: Marks a window as fullscreen.
; Syntax.........: TB_MarkFullscreenWindow($hWnd, $bFullscreen)
; Parameters.....: $hWnd - The handle of the window to be marked.
;                  $bFullscreen - Boolean value indicating whether the window should be marked as fullscreen (True) or not (False).
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........: his function is only available on Windows WinXP and later versions of the operating system.
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_MarkFullscreenWindow($hWnd, $bFullscreen)
    Return $g__oTB.MarkFullscreenWindow($hWnd, $bFullscreen)
EndFunc   ;==>TB_MarkFullscreenWindow

#EndRegion ;**** ITaskbarList2 interface ****

#Region ;**** ITaskbarList3 interface ****
; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_RegisterTab
; Description....: Registers a tab in the thumbnail toolbar.
; Syntax.........: TB_RegisterTab($hWndTab, $hWndMDI)
; Parameters.....: $hWndTab - Handle to the tab window.
;                  $hWndMDI - The handle of the main window (the MDI client area).
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-registertab
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_RegisterTab($hWndTab, $hWndMDI)
    Return $g__oTB.RegisterTab($hWndTab, $hWndMDI)
EndFunc   ;==>TB_RegisterTab

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetOverlayIcon
; Description....: Sets the overlay icon for a toolbar button.
; Syntax.........: TB_SetOverlayIcon($hWnd, $hIcon, $sAltText = "")
; Parameters.....: $hWnd - The handle of the window whose associated taskbar button receives the overlay.
;                  $hIcon - Handle to the icon to be used as the overlay image.
;                  $sAltText - Alternative text for the button. If this parameter is an empty string,
;                  the function will use the current value of the TB_SETTOOLTIPS message.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........: This function is only available on Windows Vista and later.
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setoverlayicon
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetOverlayIcon($hWnd, $hIcon, $sAltText = "")
    Return $g__oTB.SetOverlayIcon($hWnd, $hIcon, $sAltText)
EndFunc   ;==>TB_SetOverlayIcon

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetProgressState
; Description....: Sets the progress state of a taskbar button.
; Syntax.........: TB_SetProgressState($hWnd, $iFlags)
; Parameters.....: $hWnd - The handle of the window in which the progress of an operation is being shown.
;                  $iFlags - Flags that specify the new progress state. Can be one of the following values:
;                      | (0) $TBPF_NOPROGRESS - Stops displaying progress and returns the button to its normal state.
;                      | (1) $TBPF_INDETERMINATE - The progress indicator does not grow in size, but cycles repeatedly along the length of the taskbar button.
;                      | (2) $TBPF_NORMAL - The progress indicator grows in size from left to right in proportion to the estimated amount of the operation completed.
;                      | (4) $TBPF_ERROR - The progress indicator turns red to show that an error has occurred in one of the windows that is broadcasting progress.
;                      | (8) $TBPF_PAUSED - The progress indicator turns yellow to show that progress is currently stopped in one of the windows but can be resumed by the user.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetProgressState($hWnd, $iFlags)
    Return $g__oTB.SetProgressState($hWnd, $iFlags)
EndFunc   ;==>TB_SetProgressState

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetProgress
; Description....: Sets the progress value of a taskbar button.
; Syntax.........: TB_SetProgress($hWnd, $iCurrent, $iCompleted)
; Parameters.....: $hWnd - The handle of the window whose associated taskbar button is being used as a progress indicator.
;                  $iCurrent - The current progress value.
;                  $iCompleted - The completed progress value.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: nine
; Notes .........:
; Link ..........: https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/26/#comment-1536397
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetProgress($hWnd, $iCurrent, $iCompleted)
    Return $g__oTB.SetProgressValue($hWnd, $iCurrent, $iCompleted)
EndFunc   ;==>TB_SetProgress

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetTabActive
; Description....: Sets the active tab in a thumbnail tooltip control.
; Syntax.........: TB_SetTabActive($hWndTab, $hWndMDI, $iReserved = 0)
; Parameters.....: $hWndTab - Handle of the active tab window. This handle must already be registered through RegisterTab.
;                  $hWndMDI - The handle of the main window (the MDI client area).
;                  $iReserved - Reserved for future use. Must be set to zero.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........: Note that this function is likely only useful in the context of an MDI application,
;                  where multiple tabs are managed by a single client area.
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-settabactive
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetTabActive($hWndTab, $hWndMDI, $iReserved = 0)
    Return $g__oTB.SetTabActive($hWndTab, $hWndMDI, $iReserved)
EndFunc   ;==>TB_SetTabActive

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetTabOrder
; Description....: Sets the tab order of a toolbar control.
; Syntax.........: TB_SetTabOrder($hWndTab, $hWndInsertBefore)
; Parameters.....: $hWndTab - The handle of the tab window whose thumbnail is being placed. This value is required, must already be registered through ITaskbarList3::RegisterTab
;                  $hWndInsertBefore - Handle to the window that will precede the specified window in the tab order.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-settaborder
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetTabOrder($hWndTab, $hWndInsertBefore)
    Return $g__oTB.SetTabOrder($hWndTab, $hWndInsertBefore)
EndFunc   ;==>TB_SetTabOrder

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetThumbnailClip
; Description....: Selects a portion of a window's client area to display as that window's thumbnail in the taskbar.
; Syntax.........: TB_SetThumbnailClip($hWnd, $iLeft, $iTop, $iRight, $iBottom)
; Parameters.....: $hWnd - The handle to a window represented in the taskbar.
;                  $iLeft - The left coordinate of the clipping rectangle.
;                  $iTop - The top coordinate of the clipping rectangle.
;                  $iRight - The right coordinate of the clipping rectangle.
;                  $iBottom - The bottom coordinate of the clipping rectangle.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setthumbnailclip
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetThumbnailClip($hWnd, $iLeft, $iTop, $iRight, $iBottom)
    Local $tRECTClip = DllStructCreate($tagRECT)
    DllStructSetData($tRECTClip, "Left", $iLeft)
    DllStructSetData($tRECTClip, "Top", $iTop)
    DllStructSetData($tRECTClip, "Right", $iRight)
    DllStructSetData($tRECTClip, "Bottom", $iBottom)
    Return $g__oTB.SetThumbnailClip($hWnd, DllStructGetPtr($tRECTClip))
EndFunc   ;==>TB_SetThumbnailClip

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetThumbnailTooltip
; Description....: Sets a tooltip for a thumbnail in the taskbar.
; Syntax.........: TB_SetThumbnailTooltip($hWnd, $sTooltip)
; Parameters.....: $hWnd - Handle to the window that contains the thumbnail.
;                  $sTooltip - Tooltip text to be displayed.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........: The tooltip will be displayed when the user hovers their mouse over the thumbnail.
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setthumbnailtooltip
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetThumbnailTooltip($hWnd, $sTooltip)
    Return $g__oTB.SetThumbnailTooltip($hWnd, $sTooltip)
EndFunc   ;==>TB_SetThumbnailTooltip

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_ThumbBarAddButtons
; Description....: Adds buttons to the thumbnail toolbar.
; Syntax.........: TB_ThumbBarAddButtons($hWnd, $iButtonCount, $aButtons)
; Parameters.....: $hWnd - Handle to the window that contains the thumbnail image.
;                  $iButtonCount - Number of buttons to add.
;                  $aButtons - Array of button data. Each element in the array should be a structure with the following fields:
;                   - dwMask - Mask of valid fields in this structure. Can be a combination of THUMBBUTTONMASK
;                     $THB_BITMAP = 1, $THB_ICON, $THB_TOOLTIP = 4, $THB_FLAGS = 8
;                   - iId - Unique identifier for the button. This value is returned in the $iButtonIndex parameter of the TB_ThumbBarButtonPressed notification code.
;                   - iBitmap - Handle to the bitmap that will be displayed on the button.
;                   - hIcon - Handle to the icon that will be displayed on the button.
;                   - szTip - Tooltip text for the button.
;                   - dwFlags - Flags that specify the behavior of the button. Can be a combination of THUMBBUTTONFLAGS
;                     $THBF_ENABLED=0, $THBF_DISABLED=1, $THBF_DISMISSONCLICK=2, $THBF_NOBACKGROUND=4, $THBF_HIDDEN=8, $THBF_NONINTERACTIVE=10.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-thumbbaraddbuttons
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_ThumbBarAddButtons($hWnd, $iButtonCount, $aButtons)
    ; Create a struct for each button
    ; dwFlags(THBF_ENABLED=0, THBF_DISABLED=0x1, THBF_DISMISSONCLICK=0x2, THBF_NOBACKGROUND=0x4, THBF_HIDDEN=0x8, THBF_NONINTERACTIVE=0x10)
    ; Get the size of the THUMBBUTTON structure
    Local $iStructSize = DllStructGetSize(DllStructCreate($tagTHUMBBUTTON))

    ; Calculate the total memory size needed for all button structures
    Local $pButtonsMemory = DllStructCreate("byte[" & ($iStructSize * $iButtonCount) & "]")
    If @error Then
        MsgBox(16, "Error", "Failed to create memory structure for buttons. Error: " & @error)
        Return
    EndIf

    ; Loop through and initialize each button structure
    For $i = 0 To $iButtonCount - 1
        ; Create a THUMBBUTTON struct at the correct memory location
        Local $pCurrentButton = DllStructCreate($tagTHUMBBUTTON, DllStructGetPtr($pButtonsMemory) + ($iStructSize * $i))
        If @error Then
            MsgBox(16, "Error", "Failed to create DllStruct for button " & ($i + 1) & ". Error: " & @error)
            Return
        EndIf

        ; Populate the struct with button data
        DllStructSetData($pCurrentButton, "dwMask", $aButtons[$i][0])
        DllStructSetData($pCurrentButton, "iId", $aButtons[$i][1])
        DllStructSetData($pCurrentButton, "iBitmap", $aButtons[$i][2])
        DllStructSetData($pCurrentButton, "hIcon", $aButtons[$i][3])
        DllStructSetData($pCurrentButton, "szTip", $aButtons[$i][4])
        DllStructSetData($pCurrentButton, "dwFlags", $aButtons[$i][5])

        ; Validate if data was set correctly
        If @error Then
            MsgBox(16, "Error", "Failed to set data for button " & ($i + 1) & ". Error: " & @error)
            Return
        EndIf
    Next

    ; Call the ThumbBarAddButtons method
    Local $hResult = $g__oTB.ThumbBarAddButtons($hWnd, $iButtonCount, DllStructGetPtr($pButtonsMemory))
    If $hResult <> 0 Then
        MsgBox(16, "Error", "Failed to add thumbnail toolbar buttons. HRESULT: " & $hResult)
    EndIf
EndFunc   ;==>TB_ThumbBarAddButtons

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_ThumbBarSetImageList
; Description....: Sets the image list for a thumb bar.
; Syntax.........: TB_ThumbBarSetImageList($hWnd, $hImageList)
; Parameters.....: $hWnd - The handle of the window whose thumbnail representation contains the toolbar to be updated.
;                  $hImageList - Handle to an image list containing the images for the thumb bar.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-thumbbarsetimagelist
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_ThumbBarSetImageList($hWnd, $hImageList)
    $g__oTB.ThumbBarSetImageList($hWnd, $hImageList)
EndFunc   ;==>TB_ThumbBarSetImageList

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_ThumbBarUpdateButtons
; Description....: Updates the buttons in a thumbnail toolbar.
; Syntax.........: TB_ThumbBarUpdateButtons($hWnd, $iButtonCount, $aButtons)
; Parameters.....: $hWnd - The handle of the window whose thumbnail representation contains the toolbar.
;                  $iButtonCount- Number of buttons in the array.
;                  $aButtons - Array of button data. Each element in the array should be a structure with the following fields:
;                   - dwMask - Mask of valid fields in this structure. Can be a combination of THUMBBUTTONMASK
;                     $THB_BITMAP = 1, $THB_ICON, $THB_TOOLTIP = 4, $THB_FLAGS = 8
;                   - iId - Unique identifier for the button. This value is returned in the $iButtonIndex parameter of the TB_ThumbBarButtonPressed notification code.
;                   - iBitmap - Handle to the bitmap that will be displayed on the button.
;                   - hIcon - Handle to the icon that will be displayed on the button.
;                   - szTip - Tooltip text for the button.
;                   - dwFlags - Flags that specify the behavior of the button. Can be a combination of THUMBBUTTONFLAGS
;                     $THBF_ENABLED=0, $THBF_DISABLED=1, $THBF_DISMISSONCLICK=2, $THBF_NOBACKGROUND=4, $THBF_HIDDEN=8, $THBF_NONINTERACTIVE=10.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-thumbbarupdatebuttons
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_ThumbBarUpdateButtons($hWnd, $iButtonCount, $aButtons)
    ; Create a struct for each button
    ; dwFlags(THBF_ENABLED=0, THBF_DISABLED=0x1, THBF_DISMISSONCLICK=0x2, THBF_NOBACKGROUND=0x4, THBF_HIDDEN=0x8, THBF_NONINTERACTIVE=0x10)
    ; Get the size of the THUMBBUTTON structure
    Local $iStructSize = DllStructGetSize(DllStructCreate($tagTHUMBBUTTON))

    ; Calculate the total memory size needed for all button structures
    Local $pButtonsMemory = DllStructCreate("byte[" & ($iStructSize * $iButtonCount) & "]")
    If @error Then
        MsgBox(16, "Error", "Failed to create memory structure for buttons. Error: " & @error)
        Return
    EndIf

    ; Loop through and initialize each button structure
    For $i = 0 To $iButtonCount - 1
        ; Create a THUMBBUTTON struct at the correct memory location
        Local $pCurrentButton = DllStructCreate($tagTHUMBBUTTON, DllStructGetPtr($pButtonsMemory) + ($iStructSize * $i))
        If @error Then
            MsgBox(16, "Error", "Failed to create DllStruct for button " & ($i + 1) & ". Error: " & @error)
            Return
        EndIf

        ; Populate the struct with button data
        DllStructSetData($pCurrentButton, "dwMask", $aButtons[$i][0])
        DllStructSetData($pCurrentButton, "iId", $aButtons[$i][1])
        DllStructSetData($pCurrentButton, "iBitmap", $aButtons[$i][2])
        DllStructSetData($pCurrentButton, "hIcon", $aButtons[$i][3])
        DllStructSetData($pCurrentButton, "szTip", $aButtons[$i][4])
        DllStructSetData($pCurrentButton, "dwFlags", $aButtons[$i][5])

        ; Validate if data was set correctly
        If @error Then
            MsgBox(16, "Error", "Failed to set data for button " & ($i + 1) & ". Error: " & @error)
            Return
        EndIf
    Next

    ; Call the ThumbBarUpdateButtons method
    Local $hResult = $g__oTB.ThumbBarUpdateButtons($hWnd, $iButtonCount, DllStructGetPtr($pButtonsMemory))
    If $hResult <> 0 Then
        MsgBox(16, "Error", "Failed to Update thumbnail toolbar buttons. HRESULT: " & $hResult)
    EndIf
EndFunc   ;==>TB_ThumbBarUpdateButtons

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_UnregisterTab
; Description....: Unregisters a tab from the toolbar.
; Syntax.........: TB_UnregisterTab($hWndTab)
; Parameters.....: $hWndTab - The handle of the tab window whose thumbnail is being removed.
;                  This is the same value with which the thumbnail was registered as part the group through RegisterTab
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-unregistertab
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_UnregisterTab($hWndTab)
    Return $g__oTB.UnregisterTab($hWndTab)
EndFunc   ;==>TB_UnregisterTab

#EndRegion ;**** ITaskbarList3 interface ****

#Region ;**** ITaskbarList4 interface ****

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_SetTabProperties
; Description....: Sets the properties of a tab in a toolbar control.
; Syntax.........: TB_SetTabProperties($hWndTab, $stpFlags)
; Parameters.....: $hWndTab - The handle of the tab window that is to have properties set. This handle must already be registered through RegisterTab.
;                  $stpFlags - A combination of the following values:
;                      |(0) STPF_NONE : No specific property values are specified.
;                           The default behavior is used: the tab window provides a thumbnail and peek image, either live or static as appropriate.
;                      |(1) $STPF_USEAPPTHUMBNAILALWAYS : Always use the thumbnail provided by the main application frame window rather than a thumbnail provided by the individual tab window.
;                           Do not combine this value with STPF_USEAPPTHUMBNAILWHENACTIVE; doing so will result in an error.
;                      |(2) $STPF_USEAPPTHUMBNAILWHENACTIVE : When the application tab is active and a live representation of its window is available,
;                           use the main application's frame window thumbnail. At other times, use the tab window thumbnail.
;                           Do not combine this value with STPF_USEAPPTHUMBNAILALWAYS; doing so will result in an error.
;                      |(4) $STPF_USEAPPPEEKALWAYS : Always use the peek image provided by the main application frame window rather than a peek image provided by the individual tab window.
;                           Do not combine this value with STPF_USEAPPPEEKWHENACTIVE; doing so will result in an error.
;                      |(8) $STPF_USEAPPPEEKWHENACTIVE : When the application tab is active and a live representation of its window is available,
;                           show the main application frame in the peek feature. At other times, use the tab window.
;                           Do not combine this value with STPF_USEAPPPEEKALWAYS; doing so will result in an error.
; Return values..: Success - Returns a zero value if successful
;                  Failure - Returns a non-zero value indicating the error code.
; Author ........: ioa747
; Notes .........:
; Link ..........: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist4-settabproperties
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_SetTabProperties($hWndTab, $stpFlags)
    Return $g__oTB.SetTabProperties($hWndTab, $stpFlags)
EndFunc   ;==>TB_SetTabProperties

#EndRegion ;**** ITaskbarList4 interface ****

#Region  ;**** Extra ****
; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_Flash
; Description....: Flashes a taskbar button.
; Syntax.........: TB_Flash($hWnd, $iTimes = 3, $iDelay = 300)
; Parameters.....: $hWnd - Handle to the taskbar button.
;                  $iTimes - Number of times to flash (default is 3).
;                  $iDelay - Delay between flashes in milliseconds (default is 300).
; Return values..: None.
; Author ........: nine
; Notes .........: This function uses the TaskbarButton class to interact with taskbar buttons. For more information, see the AutoIt documentation.
; Link ..........: https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/26/#comment-1536397
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_Flash($hWnd, $iTimes = 3, $iDelay = 300)
    For $i = 1 To $iTimes
        $g__oTB.SetProgressState($hWnd, 0)
        Sleep($iDelay)
        $g__oTB.SetProgressValue($hWnd, 100, 100)
        Sleep($iDelay)
    Next
    $g__oTB.SetProgressState($hWnd, 0)
EndFunc   ;==>TB_Flash

; #FUNCTION# --------------------------------------------------------------------------------------------------------------------
; Name...........: TB_GetIconHandle
; Description....: Returns a handle to an icon.
; Syntax.........: TB_GetIconHandle($iconFilePath, $iconIndex = 0)
; Parameters.....: $iconFilePath - The path of the file that contains the icon.
;                  $iconIndex    - The index of the icon in the file. Default is 0.
; Return values..: Success      - A handle to the icon.
;                  Failure      - 0, and sets @error to 1.
; Author ........: ioa747
; Notes .........: This function uses the ExtractIcon function from the shell32.dll library.
; Link ..........: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-extracticona
; Dependencies...: _WinAPI_GetModuleHandle, DllCall
;--------------------------------------------------------------------------------------------------------------------------------
Func TB_GetIconHandle($iconFilePath, $iconIndex = 0)
    Local $hInstance = _WinAPI_GetModuleHandle(0)
    Local $aResult = DllCall("shell32.dll", "hwnd", "ExtractIcon", "hwnd", $hInstance, "str", $iconFilePath, "uint", $iconIndex)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    Return $aResult[0]
EndFunc   ;==>TB_GetIconHandle

#EndRegion  ;**** Extra ****

 

Please, every comment is appreciated!
leave your comments and experiences here!
Thank you very much  :)

 

 

ITaskbarList_V3.7z

Edited by ioa747
Update

I know that I know nothing

Link to comment
Share on other sites

...
Global $idButton = GUICtrlCreateButton("Click Me", 10, 10)
Global $idButton2 = GUICtrlCreateButton("MarkFullscreenWindow = FALSE", 10, 40)
...
Global $hIcon, $bMarkFullscreenWindow = False
Global $iCnt = 0
While 1
...
        Case $idButton2
            $bMarkFullscreenWindow = Not $bMarkFullscreenWindow
            GUICtrlSetData($idButton2, "MarkFullscreenWindow = " & $bMarkFullscreenWindow)
            TB_MarkFullscreenWindow($hGUI, $bMarkFullscreenWindow)
...

The description for TB_SetActiveAlt() and TB_MarkFullscreenWindow() is the same in the UDF. Therefore I added the above to see what it does. Did nothing that  I can see.
What does it do ? ( my reading comprehension does not comprehend 😅 ) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

 

@argumentum Thank you

The same description is left over from the copy paste, since I didn't deal with them, they stayed like that

I also didn't understand many things, and many of them are related to applications with multiple tabs, the so-called (TDI) or multiple-document interface (MDI) application's

 

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SetActiveAlt method from: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist-setactivealt

SetActiveAlt marks the item associated with hwnd as the currently active item for the window's process without changing the pressed state of any item. Any user action that would activate a different tab in that process will activate the tab associated with hwnd instead. The active state of the window's item is not guaranteed to be preserved when the process associated with hwnd is not active. To ensure that a given tab is always active, call SetActiveAlt whenever any of your windows are activated. Calling SetActiveAlt with a NULL hwnd clears this state.

 

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MarkFullscreenWindow method  from: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist2-markfullscreenwindow

Setting the value of fFullscreen to TRUE, the Shell treats this window as a full-screen window, and the taskbar is moved to the bottom of the z-order when this window is active. Setting the value of fFullscreen to FALSE removes the full-screen marking, but does not cause the Shell to treat the window as though it were definitely not full-screen. With a FALSE fFullscreen value, the Shell depends on its automatic detection facility to specify how the window should be treated, possibly still flagging the window as full-screen.

Since Windows 7, call SetProp(hwnd, L”NonRudeHWND”, reinterpret_cast<HANDLE>(TRUE)) before showing a window to indicate to the Shell that the window should not be treated as full-screen. This ensures the taskbar does not adjust itself to be below the window in z-order. This is similar to ITaskbarList2::MarkFullscreenWindow(FALSE) except the Shell will not fallback to its automatic detection facility and will not treat the window as full-screen.

example:

#include <GUIConstants.au3>
#include "TaskbarList.au3" ; * <--

Local $hGUI = GUICreate("My Custom GUI", @DesktopWidth, @DesktopHeight, -8, 0, $WS_OVERLAPPEDWINDOW)
Local $idButton_1 = GUICtrlCreateButton("Exit", 50, 100, 85, 25)
Local $idButton_2 = GUICtrlCreateButton("Normal", 50, 130, 85, 25)
Local $idButton_3 = GUICtrlCreateButton("Full Screen", 50, 160, 85, 25)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idButton_1
            Exit
        Case $idButton_2
            TB_MarkFullscreenWindow($hGUI, False)
        Case $idButton_3
            TB_MarkFullscreenWindow($hGUI, True)
    EndSwitch
WEnd


 

I know that I know nothing

Link to comment
Share on other sites

Make it 4.

Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}"
Global Const $sIID_ITaskbarList4 = "{C43DC798-95D1-4BEA-9030-BB99E2983A1A}"
Global Const $tagITaskbarList4 = _
    "HrInit hresult();" & _
    "AddTab hresult(hwnd);" & _
    "DeleteTab hresult(hwnd);" & _
    "ActivateTab hresult(hwnd);" & _
    "SetActiveAlt hresult(hwnd);" & _
    "MarkFullscreenWindow hresult(hwnd;boolean);" & _
    "SetProgressValue hresult(hwnd;uint64;uint64);" & _
    "SetProgressState hresult(hwnd;int);" & _
    "RegisterTab hresult(hwnd;hwnd);" & _
    "UnregisterTab hresult(hwnd);" & _
    "SetTabOrder hresult(hwnd;hwnd);" & _
    "SetTabActive hresult(hwnd;hwnd;dword);" & _
    "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _
    "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _
    "ThumbBarSetImageList hresult(hwnd;ptr);" & _
    "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _
    "SetThumbnailTooltip hresult(hwnd;wstr);" & _
    "SetThumbnailClip hresult(hwnd;ptr);"  & _
    "SetTabProperties hresult(hwnd;int);"
Global enum $STPF_NONE, $STPF_USEAPPTHUMBNAILALWAYS, $STPF_USEAPPTHUMBNAILWHENACTIVE, $STPF_USEAPPPEEKALWAYS = 4, $STPF_USEAPPPEEKWHENACTIVE = 8

SetTabProperties is not bad...

Link to comment
Share on other sites

1 hour ago, Nine said:

SetTabProperties is not bad...

would you post an example ?

Also, instead of declaring them independently, might as well declare them all ?

Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}" ; Win2000
Global Const $sIID_ITaskbarList2 = "{602D4995-B13A-429b-A66E-1935E44F4317}" ; WinXP
Global Const $sIID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}" ; Win7
Global Const $sIID_ITaskbarList4 = "{C43DC798-95D1-4BEA-9030-BB99E2983A1A}" ; Win7
Global Const $tagITaskbarList = _
        "HrInit hresult();" & _
        "AddTab hresult(hwnd);" & _
        "DeleteTab hresult(hwnd);" & _
        "ActivateTab hresult(hwnd);" & _
        "SetActiveAlt hresult(hwnd);"

Global Const $tagITaskbarList2 = $tagITaskbarList & _
        "MarkFullscreenWindow hresult(hwnd;boolean);"

Global Const $tagITaskbarList3 = $tagITaskbarList2 & _
        "SetProgressValue hresult(hwnd;uint64;uint64);" & _
        "SetProgressState hresult(hwnd;int);" & _
        "RegisterTab hresult(hwnd;hwnd);" & _
        "UnregisterTab hresult(hwnd);" & _
        "SetTabOrder hresult(hwnd;hwnd);" & _
        "SetTabActive hresult(hwnd;hwnd;dword);" & _
        "ThumbBarAddButtons hresult(hwnd;uint;ptr);" & _
        "ThumbBarUpdateButtons hresult(hwnd;uint;ptr);" & _
        "ThumbBarSetImageList hresult(hwnd;ptr);" & _
        "SetOverlayIcon hresult(hwnd;ptr;wstr);" & _
        "SetThumbnailTooltip hresult(hwnd;wstr);" & _
        "SetThumbnailClip hresult(hwnd;ptr);"

Global Const $tagITaskbarList4 = $tagITaskbarList3 & _
        "SetTabProperties hresult(hwnd;int);"

to have a chance to use some of it in pre-win7 ?

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • ioa747 changed the title to ITaskbarList4 interface
  • 2 weeks later...

@ioa747, Is there a way to refresh thumbnail preview while the app is in minimized state? The only way I can think of is restoring the window and then immediately minimizing it again. But this work around makes the screen blink biriefly, which is somewhat annoying.

Edited by CYCho
Link to comment
Share on other sites

by cheating ?

Func RefreshThumbnailPreview($hWnd)
    ; if window is minimized
    If _WinAPI_IsIconic($hWnd) Then
        WinSetTrans($hWnd, "", 0)
        GUISetState(@SW_RESTORE)
        Sleep(100)
        GUISetState(@SW_MINIMIZE)
        WinSetTrans($hWnd, "", 255)
    EndIf
EndFunc

 

I know that I know nothing

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...