Sign in to follow this  
Followers 0
MCP

Take GUI on top

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#3 ·  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

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  
Followers 0