TaskbarList

wraps the ITaskbarList interface and exposes methods that control the taskbar.  It allows you to dynamically add, remove, and activate items on the taskbar.

Authors

License

Documentation

Requirements

AutoHotkeyAHK_L v1.1+
OSWindows 2000 Professional, Windows XP, Windows 2000 Server or higher
Base classesUnknown
Summary
TaskbarListwraps the ITaskbarList interface and exposes methods that control the taskbar.
Variables
CLSIDThis is CLSID_TaskbarList.
IIDThis is IID_ITaskbarList.
Functions
HrInitinitializes the interface.
AddTabadds a new item to the taskbar
DeleteTabdeletes an item from the taskbar
ActivateTabActivates an item on the taskbar.
SetActiveAltMarks a taskbar item as active but does not visually activate it.

Variables

CLSID

This is CLSID_TaskbarList.  It is required to create an instance.

IID

This is IID_ITaskbarList.  It is required to create an instance.

Functions

HrInit

HrInit()

initializes the interface.  You should call this before doing anything else.

Returns

BOOL successtrue on success, false otherwise.

AddTab

AddTab(hWin)

adds a new item to the taskbar

Parameters

HWND hWinthe handle to the window to add.

Returns

BOOL successtrue on success, false otherwise.

Example

ITBL := new TaskbarList()
ITBL.HrInit()
Gui +LastFound
ITBL.AddTab(WinExist())

DeleteTab

DeleteTab(hWin)

deletes an item from the taskbar

Parameters

HWND hWinthe handle to the window to remove.

Returns

BOOL successtrue on success, false otherwise.

Example

ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.DeleteTab(WinExist("Notepad"))

ActivateTab

ActivateTab(hWin)

Activates an item on the taskbar.

Parameters

HWND hWinthe handle to the window whose item should be activated.

Returns

BOOL successtrue on success, false otherwise.

Remarks

  • The window is not actually activated; the window’s item on the taskbar is merely displayed as active.

Example

ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.ActivateTab(WinExist("Mozilla Firefox"))

SetActiveAlt

SetActiveAlt(hWin)

Marks a taskbar item as active but does not visually activate it.

Parameters

HWND hWinthe handle to the window that should be marked as active.

Returns

BOOL successtrue on success, false otherwise.

Remarks

SetActiveAlt marks the item associated with hWin 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 hWin 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.

Example

ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.SetActiveAlt(WinExist())
HrInit()
initializes the interface.
AddTab(hWin)
adds a new item to the taskbar
DeleteTab(hWin)
deletes an item from the taskbar
ActivateTab(hWin)
Activates an item on the taskbar.
SetActiveAlt(hWin)
Marks a taskbar item as active but does not visually activate it.