MCP Posted October 7, 2007 Share Posted October 7, 2007 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 More sharing options...
ashley Posted October 7, 2007 Share Posted October 7, 2007 Nice! Free icons for your programs Link to comment Share on other sites More sharing options...
Valuater Posted October 7, 2007 Share Posted October 7, 2007 (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 October 7, 2007 by Valuater Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now