Page 1 of 1

Where does WinHide hide windows?

Posted: 02 Apr 2019, 06:41
by eitatetaata
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 :)

Re: Where does WinHide hide windows?

Posted: 02 Apr 2019, 08:03
by AHKStudent
You could just do a winshow with the exe

Re: Where does WinHide hide windows?

Posted: 02 Apr 2019, 08:39
by eitatetaata
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).

Re: Where does WinHide hide windows?  Topic is solved

Posted: 02 Apr 2019, 09:05
by gregster
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...)

Re: Where does WinHide hide windows?

Posted: 02 Apr 2019, 09:20
by eitatetaata
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!

Re: Where does WinHide hide windows?

Posted: 02 Apr 2019, 09:53
by Rohwedder
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