Recherche une cha�ne
#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_FindStringExact ( $hWnd, $sText [, $iIndex = -1] )
$hWnd | Handle du contr�le |
$sText | Cha�ne � rechercher |
$iIndex | [optionnel] Index, compt� � partir de 0, de l'�l�ment qui pr�c�de le premier �l�ment � rechercher |
Succ�s: | Retourne un index, compt� � partir de 0, de l'�l�ment trouv�. |
�chec: | Retourne -1. |
Trouve la premi�re cha�ne qui correspond � la cha�ne sp�cifi�e dans le param�tre $sText.
Lorsque la recherche atteint la fin de la zone de liste, la fonction continue � partir du haut de la zone de liste pour retourner � l'�l�ment sp�cifi� par $iIndex.
Si $iIndex vaut -1, la zone de liste est parcourue en entier depuis le d�but.
#include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $hGUI, $hImage, $sDelimiter = "; ", $hCombo Opt("GUIDataSeparatorChar", $sDelimiter) ; Cr�e une GUI $hGUI = GUICreate("ComboBoxEx Find String Exact", 400, 300) $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "This is; mY tExT", 2, 2, 394, 100, $CBS_SIMPLE) GUISetState(@SW_SHOW) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146) _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x0000FF, 16, 16)) _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) _GUICtrlComboBoxEx_BeginUpdate($hCombo) For $x = 0 To 8 _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x) Next _GUICtrlComboBoxEx_EndUpdate($hCombo) ; Cherche la cha�ne exacte MsgBox($MB_SYSTEMMODAL, "Information", "Found at: " & _GUICtrlComboBoxEx_FindStringExact($hCombo, "mY tExT")) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example