WinHide does not hide win 10

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
StanleyH

WinHide does not hide win 10

30 Nov 2017, 12:14

Code: Select all

DetectHiddenWindows, on
SetTitleMatchMode, 2
winhide, Calculator
sleep, 7200
winshow, Calculator 
For some odd reason notice that the icon remains in the taskbar. What are some of your solutions to resolve this?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinHide does not hide win 10

30 Nov 2017, 16:03

- 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

Code: Select all

Example: Temporarily remove the active window from the taskbar by using COM.
- Although you probably know this, I'd just point out that pinned items always leave an icon in the taskbar.

- [EDIT:] Here's another approach, temporarily changing the window parent.

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
- 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).
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
StanleyH

Re: WinHide does not hide win 10

30 Nov 2017, 17:09

jeeswg 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

Code: Select all

Example: Temporarily remove the active window from the taskbar by using COM.
- Although you probably know this, I'd just point out that pinned items always leave an icon in the taskbar.

- [EDIT:] Here's another approach, temporarily changing the window parent.

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
- 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).
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 method

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
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinHide does not hide win 10

30 Nov 2017, 17:23

- 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?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
StanleyH

Re: WinHide does not hide win 10

30 Nov 2017, 17:36

jeeswg 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?
yes, winhide works, just leaves behind the taskbar icon, something that makes no sense

I even tried winhide, ahk_class ApplicationFrameWindow, Calculator
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinHide does not hide win 10

30 Nov 2017, 18:04

This example from the documentation, the one I mentioned earlier, does it work?
DllCall
https://autohotkey.com/docs/commands/DllCall.htm

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)
}
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
StanleyH

Re: WinHide does not hide win 10

30 Nov 2017, 18:38

jeeswg wrote:This example from the documentation, the one I mentioned earlier, does it work?
DllCall
https://autohotkey.com/docs/commands/DllCall.htm

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.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinHide does not hide win 10

30 Nov 2017, 18:48

Omg, always test on 'Untitled - Notepad'. Check for processes listed in Task Manager. Use WinShow to show windows. Use something like this to list windows, to avoid having to reboot:

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
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Bross9132
Posts: 14
Joined: 08 Feb 2018, 09:46

Re: WinHide does not hide win 10

21 Feb 2018, 22:02

Topic is solved and yet the script doesn't work or am I missing something? I run the script with calculator active and it doesn't do anything.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, mikeyww and 265 guests