函数参考


_WinAPI_LoadStringEx

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

#Include <WinAPIEx.au3>
_WinAPI_LoadStringEx ( $hModule, $ID [, $iLanguage] )

参数

$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.
$ID The identifier of the string to be loaded.
$iLanguage [可选参数] The language identifier of the string resource of interest. To retrieve string for user default
language set this parameter to $LOCALE_USER_DEFAULT.

返回值

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

注意/说明

None

相关

详情参考

None

示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $hInstance, $Data

$hInstance = _WinAPI_LoadLibraryEx(@ScriptDir & '\Extras\Resources.dll', $LOAD_LIBRARY_AS_DATAFILE)
If Not $hInstance Then
    MsgBox(16, '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
$Data = _WinAPI_EnumResourceLanguages($hInstance, $RT_STRING, 376)
If IsArray($Data) Then
    For $i = 1 To $Data[0]
        ConsoleWrite(StringFormat('%-10s - %s', _WinAPI_GetLocaleInfo($Data[$i], $LOCALE_SENGLANGUAGE), _WinAPI_LoadStringEx($hInstance, 6000, $Data[$i])) & @CR)
    Next
EndIf