Jump to content

Take GUI on top


MCP
 Share

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
        WinActivate($sTitle)
        $rc = True
    EndIf
    Return $rc
EndFunc   ;==>_SwitchedOnTopoÝ÷ Ù.(!¶ëv¬Û¶*')¶¬jëh×6Func DoCreateMyGUI()
    If _SwitchedOnTop("MyGUI") Then Return
      ...
    GUICreate("MyGUI", 250, 250, -1, -1)
      ....
EndFunc
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...