#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOnEventMode", 1)
Global $g_iState = False, $g_iInput, $g_iButton1, $g_iButton2
GUICreate("Пример", 400, 80)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUICtrlCreateLabel("IniRead: ", 10, 10, 45, 20, BitOR($GUI_SS_DEFAULT_LABEL, $SS_CENTERIMAGE, $SS_RIGHT))
$g_iInput = GUICtrlCreateInput(Null, 55, 10, 335, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
GUICtrlCreateButton("Старт", 50, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Toggle")
$g_iButton1 = GUICtrlCreateButton("Кнопка 1", 155, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Events")
$g_iButton2 = GUICtrlCreateButton("Кнопка 2", 260, 40, 95, 30)
GUICtrlSetOnEvent(-1, "_Events")
GUISetState()
While Sleep(10)
WEnd
Func _Toggle()
If Not $g_iState Then
$g_iState = True
GUICtrlSetData(@GUI_CtrlId, "Стоп")
AdlibRegister("_Update")
Else
$g_iState = False
AdlibUnRegister("_Update")
GUICtrlSetData(@GUI_CtrlId, "Старт")
EndIf
EndFunc ;==>_Toggle
Func _Events()
Switch @GUI_CtrlId
Case $g_iButton1
ToolTip("Кнопка 1" & @CRLF & "Control ID: " & @GUI_CtrlId)
Case $g_iButton2
TrayTip("Кнопка 2", "Control ID: " & @GUI_CtrlId, 5)
ToolTip(Null)
EndSwitch
EndFunc ;==>_Event
Func _Update()
IniWrite("Temp.ini", "Section", "Key", Random(0, 65535))
GUICtrlSetData($g_iInput, IniRead("Temp.ini", "Section", "Key", Null))
EndFunc ;==>_Update
Func _Exit()
Exit FileDelete("Temp.ini")
EndFunc ;==>_Exit