Retourne la chaîne située à l'adresse mémoire spécifiée
#include <WinAPIMisc.au3>
_WinAPI_GetString ( $pString [, $bUnicode = True] )
$pString | Pointeur vers la chaîne terminée par null. |
$bUnicode | [optionnel] Indique si la chaîne est constituée de caractères Unicode ou ASCII, les valeurs valides sont: True - Unicode (par défaut). False - ASCII. |
Succès: | Retourne une chaîne. @extended retourne la longueur de la chaîne, en TCHARs (non compris le caractère nul de terminaison). |
Échec: | Retourne une chaîne vide et définit @error <> 0. |
#include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <WinAPIMem.au3> #include <WinAPIMisc.au3> #include <WinAPISysWin.au3> Global Const $WM_MYMESSAGE = _WinAPI_RegisterWindowMessage('MyMessage') Local $hForm = GUICreate('Test '& StringReplace(@ScriptName, '.au3', '()'), 400, 93) Local $idInput = GUICtrlCreateInput('', 20, 20, 360, 20) Local $idButton = GUICtrlCreateButton('Send', 165, 59, 70, 23) GUIRegisterMsg($WM_MYMESSAGE, 'WM_MYMESSAGE') GUISetState(@SW_SHOW) Local $pString, $iMsg = GUIGetMsg() While $iMsg <> $GUI_EVENT_CLOSE If $iMsg = $idButton Then $pString = _WinAPI_CreateString(GUICtrlRead($idInput)) _WinAPI_SetMessageExtraInfo($pString) _SendMessage($hForm, $WM_MYMESSAGE, 1, 255) _WinAPI_FreeMemory($pString) EndIf $iMsg = GUIGetMsg() WEnd Func WM_MYMESSAGE($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $pString = _WinAPI_GetMessageExtraInfo() If _WinAPI_IsMemory($pString) Then ConsoleWrite('WM_MYMESSAGE | WP = '& Number($wParam) & '| LP = '& Number($lParam) & '| EXTRA = "'& _WinAPI_GetString($pString) & '"'& @CRLF) EndIf EndFunc ;==>WM_MYMESSAGE