Skip to content

Introduction

HelgeffegleH edited this page Jul 22, 2017 · 5 revisions

The purpose of this class is to let you easily add some taskbar extensions to your application's windows. Including, button controls, icon overlay, taskbar progress bar, custom thumbnail preview and more.

First step:
#include taskbarInterface.ahk
tbi := new taskbarInterface(hwnd  [, callbackFunction])

First include the file, then specify the handle (hwnd) to the window to which the extensions will be applied. Optionally, if you are going to use the button extension, add a callback function for when the user pushes the buttons. Keep your reference until you have added all extensions, here it is called tbi.

Then add any of the following extensions,


Buttons

Buttons

Add up to seven buttons under the thumbnail preview.

Basic usage:
tbi.setButtonIcon(1, hIcon)	; Set the icon for button number 1.
tbi.showButton(1)		; Show button number 1.

Icon overlay

Overlay icon

Show application status via small icon overlay.

Basic usage:
tbi.setOverlayIcon(hIcon)

Progress bar

Progress

Show progress bar behind the taskbar icon. For changing the taskbar icon, see setTaskbarIcon() in the full documentaion.

Basic usage:
tbi.SetProgressType("Red")		; Use red color.
Loop 100 {
    tbi.setProgress(A_Index)		; Set progress to a value between 0 and 100
    someAction()			; Do something before updating the progress
}

Custom thumbnail preview

Thumbnail clip

The thumbnail preview has been clipped, to only show a portion of the window, in this case, only a listbox is shown.

Basic usage:

Select which part of the window to show in the preview,

tbi.setThumbnailClip(x,y,x+w,y+h)	

Alternatively, you can provide you own bitmap(s),

tbi.enableCustomThumnailPreview("myBitmapFunc", refreshRate:=50)

where myBitmapFunc will be called every 50 ms, whenever the thumbnail preview is showing. The function must return a bitmap handle. Setting the refresh rate to 0 and passing a bitmap handle to the method will set the preview to a static image.