Code: Select all
DetectHiddenWindows, on
SetTitleMatchMode, 2
winhide, Calculator
sleep, 7200
winshow, Calculator
Code: Select all
DetectHiddenWindows, on
SetTitleMatchMode, 2
winhide, Calculator
sleep, 7200
winshow, Calculator
Code: Select all
Example: Temporarily remove the active window from the taskbar by using COM.
Code: Select all
q:: ;temporarily change window parent
WinGet, hWnd, ID, A
hWndParent := A_ScriptHwnd
hWndParentOld := DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParent, Ptr)
Sleep, 3000
DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParentOld, Ptr)
return
;doesn't work: doesn't restore taskbar button
;w:: ;temporarily change window owner
WinGet, hWnd, ID, A
hWndOwner := A_ScriptHwnd
hWndOwnerOld := DllCall("user32\SetWindowLong" (A_PtrSize=8?"Ptr":""), Ptr,hWnd, Int,-8, Ptr,hWndOwner, Ptr) ;GWL_HWNDPARENT := -8
Sleep, 3000
DllCall("user32\SetWindowLong" (A_PtrSize=8?"Ptr":""), Ptr,hWnd, Int,-8, Ptr,hWndOwnerOld, Ptr) ;GWL_HWNDPARENT := -8
return
the code you provided works on regular windows (notepad etc) but not on windows 10 apps windows like calculator or skype, there must be a methodjeeswg wrote:- Perhaps try the example here. It accepts an hWnd for the active window or any other window.
DllCall
https://autohotkey.com/docs/commands/DllCall.htm- Although you probably know this, I'd just point out that pinned items always leave an icon in the taskbar.Code: Select all
Example: Temporarily remove the active window from the taskbar by using COM.
- [EDIT:] Here's another approach, temporarily changing the window parent.- Btw your thread might be found by more people, if you changed the title to something like: 'WinHide does not hide taskbar button (Windows 10)'. Although maybe you can't change this, since you were NLI (not logged in).Code: Select all
q:: ;temporarily change window parent WinGet, hWnd, ID, A hWndParent := A_ScriptHwnd hWndParentOld := DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParent, Ptr) Sleep, 3000 DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParentOld, Ptr) return ;doesn't work: doesn't restore taskbar button ;w:: ;temporarily change window owner WinGet, hWnd, ID, A hWndOwner := A_ScriptHwnd hWndOwnerOld := DllCall("user32\SetWindowLong" (A_PtrSize=8?"Ptr":""), Ptr,hWnd, Int,-8, Ptr,hWndOwner, Ptr) ;GWL_HWNDPARENT := -8 Sleep, 3000 DllCall("user32\SetWindowLong" (A_PtrSize=8?"Ptr":""), Ptr,hWnd, Int,-8, Ptr,hWndOwnerOld, Ptr) ;GWL_HWNDPARENT := -8 return
Code: Select all
q:: ;temporarily change window parent
WinGet, hWnd, ID, A
hWndParent := A_ScriptHwnd
hWndParentOld := DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParent, Ptr)
Sleep, 3000
DllCall("user32\SetParent", Ptr,hWnd, Ptr,hWndParentOld, Ptr)
return
yes, winhide works, just leaves behind the taskbar icon, something that makes no sensejeeswg wrote:- And the DllCall example, does that work?
- Also, try running the script as admin, just in case.
- Also, you are saying that WinHide does hide the windows, but that it doesn't hide the taskbar buttons. It at least hides the windows?
Code: Select all
/*
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("A")
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)
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)
}
it does not work on win 10 calculator or skype etc (windows apps) it works on other things like notepad it works so good that the notepad task-bar icon seems to not be gone permanently lol, ill have to reboot.jeeswg wrote:This example from the documentation, the one I mentioned earlier, does it work?
DllCall
https://autohotkey.com/docs/commands/DllCall.htmCode: Select all
/* 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("A") 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) 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) }
Code: Select all
DetectHiddenWindows, On
;WinGet, vWinList, List ;all windows
WinGet, vWinList, List, ahk_class Notepad
vOutput := ""
Loop, % vWinList
{
hWnd := vWinList%A_Index%
WinGetTitle, vWinTitle, % "ahk_id " hWnd
;WinGetClass, vWinClass, % "ahk_id " hWnd
;WinGet, vPID, PID, % "ahk_id " hWnd
vOutput .= hWnd " " vWinTitle "`r`n"
}
MsgBox, % vOutput