'listbox find string
'   以指定文本开头在列表框中找到的第一个字符串。区分大小写。
'   hWndControl: 控件的句柄 (例如  HWND_FORM1_LISTBOX1)                  
'   nIndex:      The zero-based index of the item before the first
'                item to be searched. When the search reaches the
'                bottom of the list, it continues from the top of
'                the list until it reaches the nIndex position. If
'                nIndex = -1 then the entire list is searched from
'                the beginning.             
'   SearchText:  The string that contains the prefix to search for.
'   Returns:     The return value is the index of the matching item.
'                If an error occurs, %LB_ERR is returned.
Function FF_ListBox_FindString(ByVal hWndControl as HWnd, ByVal nIndex as Long, ByRef SearchText as CWSTR) as Long
   
   '检查窗口句柄是否有效
   If IsWindow(hWndControl) Then
      ''发消息给控件
      Function = SendMessageW(hWndControl, LB_FINDSTRING, 0, Cast(LPARAM, SearchText.vptr))
   Else
      Function = LB_ERR
   End If
   
End Function

