| Obtains the volume name of a indicated drive
function VolumeName(Laufwerk: Char): string;
var max, Flags: DWORD;
Buf: array [0..MAX_PATH] of Char;
begin
try
GetVolumeInformation(PChar(Laufwerk + ':'), Buf, sizeof(Buf), nil, max, Flags, nil, 0);
Result := StrPas(buf);
except
result:='';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=(VolumeName('v'));
end; |