Where does WinHide hide windows? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
eitatetaata
Posts: 23
Joined: 28 Mar 2019, 05:27

Where does WinHide hide windows?

02 Apr 2019, 06:41

This is probably an easy question, but I haven’t been able to figure this out in the documentation: where does WinHide hide windows? And more importantly – how to retrieve a window "manually", if I hide it through WinHide, and then accidentally close the script, losing the handle to the window?

I’ve written a workaround which generally shows the window before closing a script, but it would be nice to know this anyway :)
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Where does WinHide hide windows?

02 Apr 2019, 08:03

You could just do a winshow with the exe
eitatetaata
Posts: 23
Joined: 28 Mar 2019, 05:27

Re: Where does WinHide hide windows?

02 Apr 2019, 08:39

I know how to show it with a script, I was wondering how to do it without one, when I close AHK. My original script allows me to choose a window and hide it when I need to. Let’s say I hid it, then closed the script, and I’m not even sure what window I hid before. Is there any way to see a list of hidden windows in Windows 10? Alternatively, if there is a command like WinShow which shows all hidden windows that there are, it could also work (although I would prefer the first solution).
gregster
Posts: 9074
Joined: 30 Sep 2013, 06:48

Re: Where does WinHide hide windows?  Topic is solved

02 Apr 2019, 09:05

I am not aware of a "standard" Windows program that would do this (in task manager you can still see and terminate the processes of hidden windows, though - but there will be a lot more of them that you didn't hide yourself).

That said, you are using a rather low-level method - the Windows API - to hide the windows (for this you need a programming or scripting language like AHK or a third-party program) - and then you also need the Windows API to enumerate these hidden windows and make them visible again (again you will need another tool or AHK or some other language that can call the windows API to do this.) But the Windows API will not keep track which windows excactly your script hid, afaik (so most hidden windows will have nothing to do with your script and unhiding them all won't make you happy ;) )

But you could just keep track in your script of all windows you hid (or write them to a text file, if you like) and unhide them, when you exit the script... OnExit could help. (But you seem to be already doing something like this...)
eitatetaata
Posts: 23
Joined: 28 Mar 2019, 05:27

Re: Where does WinHide hide windows?

02 Apr 2019, 09:20

I am indeed unhiding the windows upon exiting (with a loophole, but I will fix it), but I thought there had to be some obvious solution. If not, I’ll just accomodate. Thanks!
Rohwedder
Posts: 7706
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Where does WinHide hide windows?

02 Apr 2019, 09:53

Hallo,
one problem is the large number of hidden windows.
Try:

Code: Select all

Hidden = 0
DetectHiddenWindows, On
WinGet, All, List
DetectHiddenWindows, Off
WinGet, NotHidden, List
Loop, %All%
{
	ID := All%A_Index%
	Loop, %NotHidden%
		If (ID = NotHidden%A_Index%)
			ID =
	IF !ID
		Continue
	Hidden++
	Hidden%Hidden% := ID
}
MsgBox,%  "Number of windows:`nAll: " All "`nHidden: " Hidden "`nNotHidden: " NotHidden

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, krl and 97 guests