dcat127 Posted August 23, 2010 Share Posted August 23, 2010 If I create 2 different windows, how can I come back to window 1 and add another button? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $window1 = GUICreate("window 1") $window_1_button = GUICtrlCreateButton("Window 1 button", -1, -1) GUISetState() $window2 = GUICreate("window 2") $window_2_button = GUICtrlCreateButton("Window 2 button", -1, -1) GUISetState() ;make another button on window 1 $window_1_button2 = GUICtrlCreateButton("Window 2 button", 100, 100) $msg = "" While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $window_1_button MsgBox(0, "", "Window 1 clicked") Case $msg = $window_2_button MsgBox(0, "", "Window 2 clicked") EndSelect WEnd Link to comment Share on other sites More sharing options...
dcat127 Posted August 23, 2010 Author Share Posted August 23, 2010 Found solution myself : use GUISwitch #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $window1 = GUICreate("window 1") $window_1_button = GUICtrlCreateButton("Window 1 button", -1, -1) GUISetState() $window2 = GUICreate("window 2") $window_2_button = GUICtrlCreateButton("Window 2 button", -1, -1) GUISetState() ;make another button on window 1 GUISwitch($window1) $window_1_button2 = GUICtrlCreateButton("Window 2 button", 100, 100) $msg = "" While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $window_1_button MsgBox(0, "", "Window 1 clicked") Case $msg = $window_2_button MsgBox(0, "", "Window 2 clicked") EndSelect WEnd 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