Display Drive Name

posted 18 Sep 2010, 14:39 by Delphi Basics
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;
Comments