Display Drive Name

Post date: Sep 18, 2010 9:39:46 PM

Returns the display name for the drive with the given root path.

function DriveDisplayName(const Drive: string): string;
var
  FI: ShellAPI.TSHFileInfo; // info about drive
begin
  ShellAPI.SHGetFileInfo(
    PChar(Drive),
    0,
    FI,
    SizeOf(FI),

ShellAPI.SHGFI_DISPLAYNAME);

  Result := FI.szDisplayName;
end;