#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GuiListBox.au3>
Local $hGui, $iListBox, $hListBox, $iInput
; Создаёт GUI
$hGui = GUICreate('Поиск строки в ListBox', 400, 330)
$iInput = GUICtrlCreateInput('', 10, 330 - 30, 240, 22, -1, $WS_EX_STATICEDGE)
$iListBox = GUICtrlCreateList("", 0, 0, 396, 296)
$hListBox = GUICtrlGetHandle(-1)
; Добавляет строки
_GUICtrlListBox_BeginUpdate($hListBox)
For $i = 1 To 999
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d", $i))
Next
_GUICtrlListBox_EndUpdate($hListBox)
GUISetState()
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam)
Local $nNotifyCode, $nID, $sText, $iInput0
$nNotifyCode = BitShift($iwParam, 16)
$nID = BitAND($iwParam, 0xFFFF)
Switch $hWnd
Case $hGui
Switch $nID
Case $iInput
Switch $nNotifyCode
Case $EN_CHANGE
; Поиск пункта
Local $sInp = GUICtrlRead($iInput)
Local $iIndex = _GUICtrlListBox_FindString($hListBox, $sInp)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND