Jump to content

WinSetOnTop Undo


Recommended Posts

Hello Guys ...

I'm trying to make a simple script but already failing at it :(

I want that the Window is Always on top when i press the Button for the first time ...

If it's pressed again window shouldn't be always on top anymore

I hope anyone is able to help me with that problem.

there's what i got yet :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 88, 32, 249, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Winontop="0"
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $Winontop="0" Then
            WinSetOnTop($Form1,"",1)
            $Winontop="1"
        Else
        ????
        $Winontop="0"
        EndIf
        EndSwitch
WEnd
Link to comment
Share on other sites

;http://www.autoitscript.com/forum/topic/153282-winsetontop-undo/
;Post #1
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png
;by HalliHallistra

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 88, 32, 249, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Winontop="0"
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $Winontop="0" Then
            WinSetOnTop($Form1,"",1)
            $Winontop="1"
        Else
            WinSetOnTop($Form1,"",0)
        $Winontop="0"
        EndIf
        EndSwitch
WEnd

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

;http://www.autoitscript.com/forum/topic/153282-winsetontop-undo/
;Post #1
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png
;by HalliHallistra

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 88, 32, 249, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Winontop="0"
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $Winontop="0" Then
            WinSetOnTop($Form1,"",1)
            $Winontop="1"
        Else
            WinSetOnTop($Form1,"",0)
        $Winontop="0"
        EndIf
        EndSwitch
WEnd

Didn't think it was that easy, thank you very much ! :)

Can't Press the Like This! Button ... but remember i like it XD

Edited by HalliHallistra
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...