Jump to content

Recommended Posts

Posted

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
Posted (edited)

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

8)

Edited by Valuater

NEWHeader1.png

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
×
×
  • Create New...