Get Volume Name

This function used to get volume name.

function VolumeName(DriveName: Char): string;
var
max, Flags: DWORD;
Buf: array [0..MAX_PATH] of Char;
begin
try
GetVolumeInformation(PChar(DriveName + ‘:\’), Buf, sizeof(Buf), nil, max, Flags, nil, 0);
Result := StrPas(buf);
except
result := ”;
end;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Edit1.Text := VolumeName(‘C’);
end;

Download: Source Code

One Response to “Get Volume Name”

  1. Adams says:

    Thanks for your source code

Leave a Reply

Please copy the string e28lhv to the field below: