ImageEn, unit iexWindowsFunctions

GetWindowsFileDisplayName


Declaration

function GetWindowsFileDisplayName(const sFilename : String): String;


Description

Calls ShGetFileInfo to return the display name for a file or folder (SHGFI_DISPLAYNAME), e.g. the Windows document folder would return 'Documents' (or the localized equivalent).
Result is '' if the operation failed.

For folders, if there is not a system name (e.g. "Pictures" or "Documents"), just the folder name is returned. For files, it will be just the filename with or without an extension (depending on whether "File name extensions" is enabled in File Explorer).


Example

lblName.Caption := GetWindowsFileDisplayName( 'C:\Users\Default\Documents\' );