Sign in to follow this  
Followers 0
AngelicCare

Windows Vista: Weird WinSetOnTop() behavior.

1 post in this topic

Code to start program (this part works):

Global $GlobalMatchMode
$GlobalMatchMode = 3
...
$CurrentWindow = WinGetHandle("[ACTIVE]","")
Run("c:\exe\desktopzoom.exe","c:\exe");EnvGet("WINDIR") & "\system32"
$ZoomWindowMoved = 0
Sleep(2000)
WinActivate($CurrentWindow)

And the following code associated with hotkey does not work:

Opt("WinTitleMatchMode",4)
$CurrentWindow = WinGetHandle("[ACTIVE]","")
Opt("WinTitleMatchMode",$GlobalMatchMode)
WinSetOnTop("Zoom", "", 1)
WinActivate($CurrentWindow)
Sleep(2000)

Window remains "not on top"...

Unless...

Unless...

You put a

MsgBox(4096,"","Zoom",1)

in front of this code.

Or active another "On top" window that already was "on top" and then deactivate it (used Autohotkey "Window Spy" for example).

Then "Zoom" window stays on top.

The idea is: It sets "On top" but window does not stays on top until "Zoom" window is active and other "On top" window gets activated: it can be "Task manager", "Alt-Tab" menu, or anything else that has "On top" status. If "Zoom" is not active when switching to other "On top" program - "Zoom" does not stay on top.

Working work-around:

WinSetOnTop("Zoom", "", 1)

;Workaround for Vista "on top" bug:
$CurrentWindow = WinGetHandle("[ACTIVE]","")
WinActivate("Zoom","")     ; Desired window to set "on top"
SplashTextOn ("Zoom mode","Zoom mode", 100,50,-1,-1,16)
WinActivate("Zoom mode")
Sleep(1000)
SplashOff ( )
WinActivate($CurrentWindow)

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0