Tham khảo tài liệu 'autoit help part 69', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | GUISetOnEvent GUI_EVENT_MINIMIZE SpecialEvents GUISetOnEvent GUI_EVENT_RESTORE SpecialEvents ok1 GUICtrlCreateButton OK 10 30 50 GUICtrlSetOnEvent -1 OKPressed cancel1 GUICtrlCreateButton Cancel 0 -1 GUICtrlSetOnEvent -1 CancelPressed GUISetState @SW_SHOW Just idle around While 1 Sleep 10 WEnd EndFunc Example Func OKPressed MsgBox 0 OK Pressed ID @GUI_CtrlId WinHandle @GUI_WinHandle CtrlHandle @GUI_CtrlHandle EndFunc OKPressed Func CancelPressed MsgBox 0 Cancel Pressed ID @GUI_CtrlId WinHandle @GUI_WinHandle CtrlHandle @GUI_CtrlHandle EndFunc CancelPressed Func SpecialEvents Select Case @GUI_CtrlId GUI_EVENT_CLOSE MsgBox 0 Close Pressed ID @GUI_CtrlId WinHandle @GUI_WinHandle Exit Case @GUI_CtrlId GUI_EVENT_MINIMIZE MsgBox 0 Window Minimized ID @GUI_CtrlId WinHandle @GUI_WinHandle Case @GUI_CtrlId GUI_EVENT_RESTORE MsgBox 0 Window Restored ID @GUI_CtrlId WinHandle @GUI_WinHandle EndSelect EndFunc SpecialEvents Function Reference GUISetState Changes the state of a GUI window. GUISetState flag winhandle Parameters flag optional @SW_SHOW Shows a previously hidden window default @SW_HIDE Hide window @SW_MINIMIZE Minimize window @SW_MAXIMIZE Maximize window @SW_RESTORE Undoes a window minimization @SW_DISABLE Disables the window @SW_ENABLE Enables the window @SW_LOCK Lock the window to avoid repainting. @SW_UNLOCK Unlock windows to allow painting. winhandle optional Windows handle as returned by GUICreate default is the previously used window . Return Value Success Returns 1. Failure Returns 0. Remarks When windows are created they are initially hidden so you must use this function to display them @SW_SHOW . Only one window can be locked with @SW_LOCK. Any other @SW_LOCK will lock the requested window. @SW_UNLOCK just ignored the winhandle to unlock any locked window. Related GUICreate Example include Opt MustDeclareVars 1 Example Func Example Local msg GUICreate My GUI start the definition GUISetState will display an empty dialog box Run the GUI .