Jump to content
Sign in to follow this  

Take GUI on top

Recommended Posts

If you need to be sure that only one GUI exists and if one already exists is shown to the user instead of recreating it from scratch, you may find that this small code snippet is useful.

It is not a complex matter, but the purpose is to keep code short and clean to understand.

; Description:      Put the window on top, if it exists
; Syntax:           _SwitchedOnTop($sTitle)
; Parameter(s):     $sTitle is the GUI title
; Requirement(s):   $sTitle
; Return Value(s):  On Success - True
;                   On Failure - False
; Author(s):        MCP, aka Aristotele.Skotos aka ...

Func _SwitchedOnTop($sTitle)
    Local $rc = False
    If WinExists($sTitle) Then
        $rc = True
    Return $rc
EndFunc   ;==>_SwitchedOnTopoÝ÷ Ù.(!¶ëv¬Û¶*')¶¬jëh×6Func DoCreateMyGUI()
    If _SwitchedOnTop("MyGUI") Then Return
    GUICreate("MyGUI", 250, 250, -1, -1)

Share this post

Link to post
Share on other sites

You might want to change this to "Window Activate" because to actually set the window on-top use

WinSetOnTop ( "title", "text", flag )

its a little different


Edited by Valuater


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...