Mike T
Mike T

Reputation: 492

Relocating a HTA without changing window focus

I have an HTML application, written primarily in VBScript.
The application is refreshed every 10 minutes, and part of the refresh is the window being relocated. However, I don't want to disturb whatever the user might be doing by relocating the window and making it pop up in front of the current window (giving it focus).

So I dont necessarily need a way to send the window to the bottom of the window order..I just need a way to move the application "behind the scenes" so to speak.

My current attempt involves pausing for a tenth of a second until the window gains focus, then using Wshell.SendKeys Alt-Esc to move it to the back of the window order. The problem with this is that if there is no pause, the window does not have focus by the time Alt-Esc is sent. And if there is a pause, the window flashes brefily on the current screen before disappearing.

So if there is a way to do this, what is it? Doesn't have to be pretty - as long as it works. All answers appreciated.

Upvotes: 2

Views: 514

Answers (1)

Mike T
Mike T

Reputation: 492

The answer is to say:

Window.focus

THEN

WshShell.SendKeys "%{ESC}"

Hope this helps someone else!

Upvotes: 1

Related Questions