-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathTaskbarList.ahk
140 lines (115 loc) · 3.61 KB
/
TaskbarList.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
class: 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:
- maul.esel (https://github.com/maul-esel)
License:
- *LGPL* (http://www.gnu.org/licenses/lgpl-2.1.txt)
Documentation:
- *class documentation* (http://maul-esel.github.com/COM-Classes/master/TaskbarList)
- *msdn* (http://msdn.microsoft.com/en-us/library/windows/desktop/bb774652)
Requirements:
AutoHotkey - AHK v2 alpha
OS - Windows 2000 Professional, Windows XP, Windows 2000 Server or higher
Base classes - _CCF_Error_Handler_, Unknown
*/
class TaskbarList extends Unknown
{
/*
Field: CLSID
This is CLSID_TaskbarList. It is required to create an instance.
*/
static CLSID := "{56FDF344-FD6D-11d0-958A-006097C9A090}"
/*
Field: IID
This is IID_ITaskbarList. It is required to create an instance.
*/
static IID := "{56FDF342-FD6D-11d0-958A-006097C9A090}"
/*
Method: HrInit
initializes the interface. You should call this before doing anything else.
Returns:
BOOL success - true on success, false otherwise.
*/
HrInit()
{
return this._Error(DllCall(NumGet(this.vt+03*A_PtrSize), "ptr", this.ptr))
}
/*
Method: AddTab
adds a new item to the taskbar
Parameters:
HWND hWin - the handle to the window to add.
Returns:
BOOL success - true on success, false otherwise.
Example:
(start code)
ITBL := new TaskbarList()
ITBL.HrInit()
Gui +LastFound
ITBL.AddTab(WinExist())
(end code)
*/
AddTab(hWin)
{
return this._Error(DllCall(NumGet(this.vt+04*A_PtrSize), "Ptr", this.ptr, "UInt", hWin))
}
/*
Method: DeleteTab
deletes an item from the taskbar
Parameters:
HWND hWin - the handle to the window to remove.
Returns:
BOOL success - true on success, false otherwise.
Example:
(start code)
ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.DeleteTab(WinExist("Notepad"))
(end code)
*/
DeleteTab(hWin)
{
return this._Error(DllCall(NumGet(this.vt+05*A_PtrSize), "Ptr", this.ptr, "UInt", hWin))
}
/*
Method: ActivateTab
Activates an item on the taskbar.
Parameters:
HWND hWin - the handle to the window whose item should be activated.
Returns:
BOOL success - true on success, false otherwise.
Remarks:
- The window is not actually activated; the window's item on the taskbar is merely displayed as active.
Example:
(start code)
ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.ActivateTab(WinExist("Mozilla Firefox"))
(end code)
*/
ActivateTab(hWin)
{
return this._Error(DllCall(NumGet(this.vt+06*A_PtrSize), "Ptr", this.ptr, "UInt", hWin))
}
/*
Method: SetActiveAlt
Marks a taskbar item as active but does not visually activate it.
Parameters:
HWND hWin - the handle to the window that should be marked as active.
Returns:
BOOL success - true 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:
(start code)
ITBL := new TaskbarList()
ITBL.HrInit()
ITBL.SetActiveAlt(WinExist())
(end code)
*/
SetActiveAlt(hWin)
{
return this._Error(DllCall(NumGet(this.vt+07*A_PtrSize), "Ptr", this.ptr, "UInt", hWin))
}
}