Locate Entry in List/Combo using API, no looping
Locate an entry in combo or listbox using API call, rather than looping through all entries.
AI
Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Codice sorgente
'Declarations Public Const LB_FINDSTRING = &H18F Public Const LB_FINDSTRINGEXACT = &H1A2 Public Const CB_FINDSTRING = &H14C Public Const CB_FINDSTRINGEXACT = &H158 Declare Function SendMessageByString& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) 'Functions Function InList(sStringToFind as string, lstListBox As ListBox) As Boolean InList = SendMessageByString(lstListBox.hwnd, LB_FINDSTRING, -1, sStringToFind) >= 0 End Function Function InCombo(sStringToFind, cbCombo As ComboBox) As Boolean InCombo = SendMessageByString(cbCombo.hwnd, CB_FINDSTRING, -1, sStringToFind) >= 0 End Function
Commenti originali (3)
Recuperato da Wayback Machine