Charge une ressource de type cha�ne � partir du fichier ex�cutable associ� � un module sp�cifi�
#include <WinAPIRes.au3>
_WinAPI_LoadString ( $hInstance, $iStringID )
$hInstance | Handle d'une instance du module dont le fichier ex�cutable contient la ressource cha�ne |
$iStringID | Sp�cifie l'identifiant, nombre entier, de la cha�ne � charger |
Succ�s: | Retourne la cha�ne demand�e, @extended est le nombre de TCHARs copi�s |
�chec: | D�finit @error <> 0 |
_WinAPI_FreeLibrary, _WinAPI_LoadLibraryEx
Consultez LoadString dans la librairie MSDN.
#include <GUIConstantsEx.au3> #include <GuiReBar.au3> #include <WinAPIError.au3> #include <WinAPIRes.au3> #include <WindowsConstants.au3> Global $g_idMemo Example() Func Example() Local $hGUI, $idInput, $id_Get, $hReBar, $hInstance, $sText, $iMsg ; Cr�e une GUI $hGUI = GUICreate("WinAPI", 400, 396) $idInput = GUICtrlCreateInput("4209", 0, 0, 100, 20) ; Cr�e un contr�le conteneur de ruban $hReBar = _GUICtrlRebar_Create($hGUI, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS)) $g_idMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont($g_idMemo, 10, 400, 0, "Courier New") ; Ajoute un ruban contenant le contr�le Input _GUICtrlRebar_AddBand($hReBar, GUICtrlGetHandle($idInput), 120, 200, "String ID:") $id_Get = GUICtrlCreateButton("Get String", 0, 0, 90, 20) ; Ajoute un ruban contenant le contr�le Button _GUICtrlRebar_AddBand($hReBar, GUICtrlGetHandle($id_Get), 120, 200) GUISetState(@SW_SHOW) $iMsg = GUIGetMsg() While $iMsg <> $GUI_EVENT_CLOSE If $iMsg = $id_Get Then GUICtrlSetData($g_idMemo, "") $hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE) If $hInstance Then $sText = _WinAPI_LoadString($hInstance, GUICtrlRead($idInput)) If Not @error Then MemoWrite('Got the String (chars: '& @extended & '): '& @CRLF & $sText) Else MemoWrite("Last Error Message: " & @CRLF & _WinAPI_GetLastErrorMessage()) EndIf MemoWrite(@CRLF & "Success Freeing? " & _WinAPI_FreeLibrary($hInstance)) EndIf EndIf $iMsg = GUIGetMsg() WEnd EndFunc ;==>Example ; Ecrit un message dans le contr�le Memo Func MemoWrite($sMessage = "") GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite