Created
October 29, 2012 17:06
-
-
Save joelpt/3974923 to your computer and use it in GitHub Desktop.
Hide the Sidewise icon from the Windows taskbar and take it out of the alt-tab list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;#NoTrayIcon ; uncomment this to also hide this script's systray icon | |
init() | |
return | |
init() { | |
; Configure event hook for window-created message reception | |
Gui +LastFound | |
hWnd := WinExist() | |
DllCall( "RegisterShellHookWindow", UInt,hWnd ) | |
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" ) | |
OnMessage( MsgNum, "ShellMessage" ) | |
HideSidewise() | |
return | |
} | |
HideSidewise() { | |
title := "Sidewise ahk_class Chrome_WidgetWin_1" | |
if (!WinExist(title)) { | |
return | |
} | |
WinSet, ExStyle, +0x80, %title% ; hide from alt-tab order | |
RemoveWindowFromTaskbar(title) | |
return | |
} | |
RemoveWindowFromTaskbar(WinTitle) { | |
/* | |
Example: Temporarily remove the active window from the taskbar by using COM. | |
Methods in ITaskbarList's VTable: | |
IUnknown: | |
0 QueryInterface -- use ComObjQuery instead | |
1 AddRef -- use ObjAddRef instead | |
2 Release -- use ObjRelease instead | |
ITaskbarList: | |
3 HrInit | |
4 AddTab | |
5 DeleteTab | |
6 ActivateTab | |
7 SetActiveAlt | |
*/ | |
IID_ITaskbarList := "{56FDF342-FD6D-11d0-958A-006097C9A090}" | |
CLSID_TaskbarList := "{56FDF344-FD6D-11d0-958A-006097C9A090}" | |
; Create the TaskbarList object and store its address in tbl. | |
tbl := ComObjCreate(CLSID_TaskbarList, IID_ITaskbarList) | |
activeHwnd := WinExist(WinTitle) | |
DllCall(vtable(tbl,3), "ptr", tbl) ; tbl.HrInit() | |
DllCall(vtable(tbl,5), "ptr", tbl, "ptr", activeHwnd) ; tbl.DeleteTab(activeHwnd) | |
Sleep 3000 | |
DllCall(vtable(tbl,4), "ptr", tbl, "ptr", activeHwnd) ; tbl.AddTab(activeHwnd) | |
; Non-dispatch objects must always be manually freed. | |
ObjRelease(tbl) | |
return | |
} | |
vtable(ptr, n) { | |
; NumGet(ptr+0) returns the address of the object's virtual function | |
; table (vtable for short). The remainder of the expression retrieves | |
; the address of the nth function's address from the vtable. | |
return NumGet(NumGet(ptr+0), n*A_PtrSize) | |
} | |
ShellMessage( wParam,lParam ) | |
{ | |
WinGetClass, Class, ahk_id %lParam% | |
WinGetTitle, Title, ahk_id %lParam% | |
if ((wParam == 6 || wParam == 1 || wParam == 2) && (Title == "Sidewise" && Class == "Chrome_WidgetWin_1")) | |
{ | |
HideSidewise() | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment