I was looking to do the same/similar. I pulled the following code from here
https://autohotkey.com/board/topic/8107 ... es-in-ahk/.
Code: Select all
#SingleInstance Force
#Persistent
IID := "{56FDF342-FD6D-11d0-958A-006097C9A090}", CLSID := "{56FDF344-FD6D-11d0-958A-006097C9A090}", S_OK := 0x00
ptr := ComObjCreate(CLSID, IID)
vtbl := NumGet(ptr + 0, 0, "Ptr")
hrInit := NumGet(vtbl + 0, 3 * A_PtrSize, "Ptr")
addTab := NumGet(vtbl + 0, 4 * A_PtrSize, "Ptr")
deleteTab := NumGet(vtbl + 0, 5 * A_PtrSize, "Ptr")
if (DllCall(hrInit, "Ptr", ptr) != S_OK)
{
MsgBox Error!
ExitApp
}
WinGet, WMC_ID, ID, ahk_exe ehshell.exe
DllCall(deleteTab, "Ptr", ptr, "Ptr", WMC_ID)
I was looking to hide my Windows Media Centers button on the taskbar and from the Alt-Tab menu, this accomplishes it whilst still leaving the window accessible from my AHK script.
To bring the button back just add
Code: Select all
DllCall(addTab, "Ptr", ptr, "Ptr", WMC_ID)
.
Works a treat.