I was reminded of this thread this morning.
jpuziano wrote:1) Once it is running, is there any way to change its mode back to "normal" for a time...?
After a little experimenting I discovered that you can "unhide" a hidden window simply by setting focus to it. You could also use the SetWindowPos API function as described by Marcus. As Marcus mentioned, generally, if you started a window running you know the name of the window and if you know its name you can set focus to it.
jpuziano wrote:1) ... then back to "hidden"?
I also discovered a way to use the SetWindowPos API function to put a window into the "hidden" condition. First you need to get the window's handle wihich can be done as Marcus described using the FindWindowA API function. Or, any version of Macro Scheduler since version 7.3 can use GetWindowHandle>. Next you use the SetWindowPos API function with SWP_HIDEWINDOW to put the window back into the "hidden" condition.
Here's a sample script to demonstrate. When this script has finished running, you'll need to open Task Manager and kill the open yet invisible notepad session. Note that notepad is not visible on the screen, it does not show up in the taskbar and is not in the ALT+Tab list. It is running but hidden.
Hope that somebody finds this information useful.
Dick
Code: Select all
Let>RP_WINDOWMODE=0
Run>notepad.exe
mdl>Press ok to make notepad visible
//setfocus makes an invisible window, visible.
SetFocus>notepad*
GetWindowHandle>notepad*,winhandle
mdl>Press ok to make notepad invisible again
Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>HWND_BOTTOM=1
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
Let>SWP_HIDEWINDOW=128
Let>Flags={%SWP_HIDEWINDOW% Or %SWP_NOACTIVATE% Or %SWP_NOSIZE% Or %SWP_NOMOVE%}
LibFunc>User32,SetWindowPos,swpr,winhandle,HWND_BOTTOM,0,0,0,0,Flags
//For some reason the window still shows up in ALT+Tab until
//you set focus to another window, then its gone.
//Setting focus to the desktop should be safe.
SetFocus>Program Manager*