#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Opt('MustDeclareVars', 1)
Global $aWord[4][3] = [['', 0x000000, 0xFFFFFF],['Привет', 0x008000, 0xF5F5DC],['Мир', 0xFF0000, 0x00FFFF],['AutoIt', 0x0000FF, 0xFFFACD]], $hGui, $nEdit
$hGui = GUICreate('Test', 220, 180)
$nEdit = GUICtrlCreateEdit('Ctrl+1', 10, 10, 200, 20, BitOR($GUI_SS_DEFAULT_EDIT, $ES_CENTER))
GUISetState()
GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND')
HotKeySet('^1', '_Change')
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Change()
Local $i_Rand = Random(1, 3, 1)
Local Static $i__Rand = -1
While $i_Rand = $i__Rand
$i_Rand = Random(1, 3, 1)
WEnd
$i__Rand = $i_Rand
GUICtrlSetData($nEdit, '')
GUICtrlSetData($nEdit, $aWord[$i__Rand][0], 1)
EndFunc ;==>_Change
Func _WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
Local $nNotifyCode, $nID, $sText, $iInd
Local Static $i__Ind = -1
$nNotifyCode = BitShift($iwParam, 16)
$nID = BitAND($iwParam, 0xFFFF)
Switch $hWnd
Case $hGui
Switch $nID
Case $nEdit
Switch $nNotifyCode
Case $EN_CHANGE
$sText = GUICtrlRead($nEdit)
For $i = 1 To 3
If $sText == $aWord[$i][0] Then
$iInd = $i
ExitLoop
EndIf
Next
If $i__Ind <> $iInd Then
$i__Ind = $iInd
GUICtrlSetColor($nEdit, $aWord[$i__Ind][1])
GUICtrlSetBkColor($nEdit, $aWord[$i__Ind][2])
EndIf
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_COMMAND