#region: - Option Opt('GUIOnEventMode', 1) Opt('MustDeclareVars', 1) Opt('TrayIconDebug', 1) Opt('TrayIconHide', 0) #endregion #region: - Include #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #endregion HotKeySet('{ESC}', '_Pro_Exit') #region: - Main Win Global, Functions Global $hMainWin Func _MainWin_Create() $hMainWin = GUICreate('Главное окно', 330, 185, 10, @DesktopHeight/3) GUISetOnEvent($GUI_EVENT_CLOSE, '_Pro_Exit') GUICtrlCreateButton('MsgBox', 20, 20, 100, 23) GUICtrlSetOnEvent(-1, '_MsgBox') ; Exit GUICtrlCreateButton('Exit', 330-100-10, 130+10+10, 100, 23) GUICtrlSetOnEvent(-1, '_Pro_Exit') GUISetState(@SW_SHOW, $hMainWin) EndFunc #endregion #region: - Other Win Global, Functions Global $hOtherWin Func _OtherWin_Create() $hOtherWin = GUICreate('Другое окно', 330, 185, @DesktopWidth-400, @DesktopHeight/3) GUISetOnEvent($GUI_EVENT_CLOSE, '_Pro_Exit') GUICtrlCreateButton('MsgBox', 20, 20, 100, 23) GUICtrlSetOnEvent(-1, '_MsgBox') ; Exit GUICtrlCreateButton('Exit', 330-100-10, 130+10+10, 100, 23) GUICtrlSetOnEvent(-1, '_Pro_Exit') GUISetState(@SW_SHOW, $hOtherWin) EndFunc #endregion #region: - After creating all GUI _MainWin_Create() _OtherWin_Create() #endregion #region: - Sleep, Exit While 1 Sleep(10) WEnd Func _Pro_Exit() Exit EndFunc #endregion Func _MsgBox() Switch @GUI_WinHandle Case $hMainWin MsgBox(0, 'Инфо', 'Последнее активное окно:' & @CRLF & 'Главное окно') Case $hOtherWin MsgBox(0, 'Инфо', 'Последнее активное окно:' & @CRLF & 'Другое окно') EndSwitch EndFunc |