Modify ↓
#3622 closed Bug (No Bug)
AU3_ControlCommandByHandle FindString in ListBox
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.14.5 | Severity: | None |
| Keywords: | FindString ListBox | Cc: |
Description
AU3_ControlCommandByHandle FindString in ListBox return 0 if not found as the ListBox is 0 based.
Should return -1 like ::SendMessage(h, LB_FINDSTRINGEXACT, 0, L"") does
Attachments (0)
Note:
See TracTickets
for help on using tickets.

If the string is not found then @error is set - use this to differentiate between the 2 cases:
#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 200, 200) GUICtrlSetData($cList, "A|B|C|D|E") GUISetState() $iRet = ControlCommand($hGUI, "", $cList, "FindString", "F") ConsoleWrite("Not in list = F: " & $iRet & " - error: " & @error & @CRLF) $iRet = ControlCommand($hGUI, "", $cList, "FindString", "A") ConsoleWrite("In list = A: " & $iRet & " - error: " & @error & @CRLF) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndM23