Page 1 of 1

Hiding an always-on-top window

Posted: 06 Jun 2021, 09:05
by MasterBlaster
I have a game that runs in windowed mode for a few seconds, then automatically changes to exclusive fullscreen.

I want to hide the initial window so the game isn't visible until it enters fullscreen. It's tricky because the game runs in an always-on-top window and there's no way to change this behavior in the game itself.

Here's what I've tried:
  1. Draw GUI: I used AHK's GUI function to draw an always-on-top overlay to hide the game window. However, the game window took priority over my GUI.
  2. Modify Game Window: I used AHK to remove the always-on-top property from my game window. Problem is, this doesn't take effect right away, so the window still flashes on the screen.
It would be great if I could remove the always-on-top property from the game window before the window opens, but I don't think this is possible.

Another option is to use AHK to turn off my monitor before the game launches, then turn it back on once the game enters fullscreen mode. Is there a better way to approach this?

Re: Hiding an always-on-top window

Posted: 06 Jun 2021, 09:53
by doubledave22
Hi, have you tried the run command with minimized or hidden?

Code: Select all

Run, prog.exe, , Hide
Run, prog.exe, , Min
I'm not sure all programs respond to this but worth a shot. Also in the shortcut for the program you can go to properties -> shortcut -> run -> minimized then have your script wait a few seconds and restore it.

I'm not sure your exact goal but you could also try to have the program run on a separate monitor in windowed mode then move it and full screen on your main monitor possibly.

All just ideas!

Re: Hiding an always-on-top window

Posted: 09 Jun 2021, 09:14
by MasterBlaster
Thanks for the suggestions! I tried hide/min as well as the shortcut, but the game still displays the window.

I'm only using one monitor (the game runs in an arcade cabinet). Is there a way to simulate a second display even if I don't physically have one?

Re: Hiding an always-on-top window

Posted: 09 Jun 2021, 16:58
by YoucefHam
try this

Code: Select all

WinWait, ahk_exe notepad.exe
Sleep, 250
WinMove, ahk_exe notepad.exe,, % A_ScreenWidth, 0, 0, 0
Sleep, 2000
WinMove, ahk_exe notepad.exe,, 0, 0, 500, 400