Jump to content

[solved] SetThumbnailTooltip


Recommended Posts

==> The requested action with this object has failed.:

What am I doing wrong here?

https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setthumbnailtooltip

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIError.au3>

$hGUI = GUICreate("AutoIt v3", 400, 100)
GUISetState()

_SetThumbnailTooltip($hGUI, "AutoIt v3" & @CRLF & "A BASIC-like scripting language")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

    EndSwitch
WEnd

GUIDelete($hGUI)

Func _SetThumbnailTooltip($hWnd, $sText)
    ; Declare the CLSID, IID, and interface description for ITaskbarList3.
    Local Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}"
    Local Const $sIID_ITaskbarList3 = "{ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf}"
    Local Const $sTagITaskbarList3 = "HrInit hresult(); AddTab hresult(hwnd); DeleteTab hresult(hwnd); SetThumbnailTooltip hresult(hwnd;wstr);"

    ; Create the object.
    Local $oTB = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList3, $sTagITaskbarList3)

    ; Initialize the iTaskbarList3 object.
    $oTB.HrInit()

    Sleep(3000)

    ; Delete the entry from the Taskbar.
    $oTB.DeleteTab($hWnd)

    Sleep(3000)

    ; AddTab the entry to Taskbar.
    $oTB.AddTab($hWnd)

    Sleep(3000)

    ; Attempt to set the tooltip for the taskbar thumbnail
    $sHresult = $oTB.SetThumbnailTooltip($hWnd, $sText)

EndFunc

Please, every comment is appreciated!
Thank you very much  :)

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

  • ioa747 changed the title to [solved] SetThumbnailTooltip

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