Function Reference


_WinAPI_LoadStringEx

Loads a string resource for the specified language from the specified module

#include <WinAPIRes.au3>
_WinAPI_LoadStringEx ( $hModule, $iID [, $iLanguage = $LOCALE_USER_DEFAULT] )

Parameters

$hModule A handle to an instance of the module whose executable file contains the string resource.
Also, this parameter can specify the name of the module to load, it must be a full or relative path.
If this parameter is 0 or an empty string, that is equivalent to passing in a handle to the module
used to create the current process.
$iID The identifier of the string to be loaded.
$iLanguage [optional] The language identifier of the string resource of interest. To retrieve string for user default
language set this parameter to $LOCALE_USER_DEFAULT (Default).

Return Value

Success: The string.
Failure: Empty string and sets the @error flag to non-zero.

Example

#include <APILocaleConstants.au3>
#include <APIResConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPILocale.au3>
#include <WinAPIRes.au3>

Local $hInstance = _WinAPI_LoadLibraryEx(@ScriptDir & '\Extras\Resources.dll', $LOAD_LIBRARY_AS_DATAFILE)
If Not $hInstance Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', @ScriptDir & '\Extras\Resources.dll not found.')
        Exit
EndIf

; Why is the resource name for the string with ID = 6000 is 376? 6000 / 16 + 1 = 376
Local $aData = _WinAPI_EnumResourceLanguages($hInstance, $RT_STRING, 376)
If IsArray($aData) Then
        For $i = 1 To $aData[0]
                ConsoleWrite(StringFormat('%-10s - %s', _WinAPI_GetLocaleInfo($aData[$i], $LOCALE_SENGLANGUAGE), _WinAPI_LoadStringEx($hInstance, 6000, $aData[$i])) & @CRLF)
        Next
EndIf