Function Reference


_WinAPI_ShellSetLocalizedName

Sets the localized name of a file in a Shell folder

#include <WinAPIShellEx.au3>
_WinAPI_ShellSetLocalizedName ( $sFilePath, $sModule, $iResID )

Parameters

$sFilePath The path to the target file.
$sModule The path to the module containing string resource that specifies the localized version of the file name.
$iResID ID of the localized file name resource.

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

Remarks

When this string is set, Windows Explorer displays this string instead of the file name. The path to the file
is unchanged.

This function requires Windows Vista or later.

See Also

Search SHSetLocalizedName in MSDN Library.

Example

#include <MsgBoxConstants.au3>
#include <WinAPIShellEx.au3>
#include <WinAPIShPath.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')
        Exit
EndIf

Local Const $sDll = @ScriptDir & '\Extras\Resources.dll'
Local Const $sDir = @TempDir & '\Temporary Folder'

If Not FileExists($sDll) Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', $sDll & ' not found.')
        Exit
EndIf

If Not DirCreate($sDir) Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Unable to create folder.')
        Exit
EndIf

_WinAPI_ShellOpenFolderAndSelectItems($sDir)
MsgBox(($MB_ICONINFORMATION + $MB_SYSTEMMODAL), '', 'Press OK to set localized name for "' & _WinAPI_PathStripPath($sDir) & '".')
_WinAPI_ShellSetLocalizedName($sDir, $sDll, 6000)
MsgBox(($MB_ICONINFORMATION + $MB_SYSTEMMODAL), '', 'Press OK to remove localized name.')
_WinAPI_ShellRemoveLocalizedName($sDir)
MsgBox(($MB_ICONINFORMATION + $MB_SYSTEMMODAL), '', 'Press OK to exit.')

DirRemove($sDir, $DIR_REMOVE)