Obtient la position inter-caractères avant le mot suivant
#include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharPosOfNextWord ( $hWnd, $iCpStart )
$hWnd | Handle du contrôle |
$iCPStart | Position inter-caractères d'où démarrer |
Succès: | Retourne la position inter-caractères avant le mot suivant. |
Échec: | Retourne 0 et définit @error <> 0. |
@error: | 101 - $hWnd n'est pas une handle 102 - $iCpStart n'est pas un nombre |
"Mot" est défini au sens large; il comprend la ponctuation, les parenthèses et les tirets.
_GUICtrlRichEdit_GetCharPosOfPreviousWord, _GUICtrlRichEdit_GetCharWordBreakInfo
Consultez EM_FINDWORDBREAK dans la librairie MSDN.
#include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui, $iMsg, $idBtnNext, $idLblMsg, $hRichEdit, $iCp = 0 $hGui = GUICreate("Exemple (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Ceci est un test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) $idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60) $idBtnNext = GUICtrlCreateButton("Suivant", 270, 310, 40, 30) GUISetState(@SW_SHOW) _GUICtrlRichEdit_AppendText($hRichEdit, "AutoIt v3 est un langage de script freeware semblable à BASIC conçu pour " _ & "l'automatisation Windows GUI et le scripting en général.") Do $iMsg = GUIGetMsg() If $iMsg = $idBtnNext Then $iCp = _GUICtrlRichEdit_GetCharPosOfNextWord($hRichEdit, $iCp) GUICtrlSetData($idLblMsg, $iCp) _GUICtrlRichEdit_GotoCharPos($hRichEdit, $iCp) EndIf Until $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; Nécessaire sauf si le script se bloque ; GUIDelete(); est OK aussi EndFunc ;==>Example