Si ça peut aider :
Code : Tout sélectionner
#include <guiconstants.au3>
$gui1=GUICreate("msgbox1",200,100,-1,-1)
GUICtrlCreateLabel("le blabla",10,10,100)
$gui2=GUICreate("msgbox2",200,100,90,200)
GUICtrlCreateLabel("Leblabla2",10,10,100)
GUISetState(@SW_SHOW,$gui1)
GUISetState(@SW_SHOW,$gui2)
while 1
$msg = GUIGetMsg()
Select
case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Et
Code : Tout sélectionner
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$mainwindow = GUICreate("Hello World", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUICtrlSetOnEvent($okbutton, "OKButton")
$dummywindow = GUICreate("Dummy window for testing ", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
While 1
Sleep(1000) ; Idle around
WEnd
Func OKButton()
;Note: at this point @GUI_CTRLID would equal $okbutton
MsgBox(0, "GUI Event", "You pressed OK!")
EndFunc
Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
;@GUI_WINHANDLE will be either $mainwindow or $dummywindow
If @GUI_WINHANDLE = $mainwindow Then
MsgBox(0, "GUI Event", "You clicked CLOSE in the main window! Exiting...")
Exit
EndIf
EndFunc