Jump to content

On top of a specific window?


Recommended Posts

I'm trying to run a program on a lan-house and i need the program to run on top of the lan-house client software (VSCyber) wich i am currently admin, but i also want the script to stay ONLY on top of VSCyber and nothing else. I don't want it to get focus when other programs are running, like games, etc.

I've searched the forum, and the only thing i found was this code below, but it still doesn't work. What am i doing wrong?

I'm looking to get $MAINGUI on top of window named "VSCyber.Net Client - 2.6 - Free" alone.

Can anyone help me please? I've already lost the entire day trying to figure this thing out... :D

Func MAINGUI()

$MAINGUI= GuiCreate("Window", 205, 150, @DesktopWidth- 218, @DesktopHeight - (15 + 200), BITOR($WS_POPUP, $WS_DLGFRAME), $WS_EX_TOOLWINDOW)
$GuiPosition= WinGetPos("Window")

$meOnTop = False
While 1
    If WinActive("VSCyber.Net Client - 2.6 - Free", "") And $meOnTop = False Then
        GuiSetState(@SW_ENABLE, $MAINGUI)
        WinActivate($MAINGUI, "")
        $meOnTop = True
    EndIf
    If Not WinActive("VSCyber.Net Client - 2.6 - Free", "") And $meOnTop = True Then
        GuiSetState(@SW_DISABLE, $MAINGUI)
        
    EndIf
    Sleep(200)
WEnd
EndFunc
Link to comment
Share on other sites

Maybe...

Func MAINGUI()

    $MAINGUI = GUICreate("Window", 205, 150, @DesktopWidth - 218, @DesktopHeight - (15 + 200), BitOR($WS_POPUP, $WS_DLGFRAME), $WS_EX_TOOLWINDOW)
    $GuiPosition = WinGetPos("Window")
    WinSetOnTop("Window", "", 1)

    $meOnTop = False
    While 1
        If WinActive("VSCyber.Net Client - 2.6 - Free", "") And $meOnTop = False Then
            GUISetState(@SW_SHOW, $MAINGUI)
            $meOnTop = True
        EndIf
        If Not WinActive("VSCyber.Net Client - 2.6 - Free", "") And $meOnTop = True Then
            GUISetState(@SW_HIDE, $MAINGUI)
        EndIf
        Sleep(200)
    WEnd
EndFunc   ;==>MAINGUI

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...