Главная страница | назад





Article #15639: Getting the serial number of a disk.

 Question and Answer Database
FAQ639D.txt Getting the serial number of a disk.
Category :Windows API
Platform :All
Product :All 32 bit
Question:
How do I retrieve the serial number of a disk?
Answer:
You can use the Windows API function GetVolumeInformation()
procedure TForm1.Button1Click(Sender: TObject);
var
VolumeSerialNumber : DWORD;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
SerialNumber : string;
begin
GetVolumeInformation('C:\',
nil,
0,
@VolumeSerialNumber,
MaximumComponentLength,
FileSystemFlags,
nil,
0);
SerialNumber := IntToHex(HiWord(VolumeSerialNumber), 4) +
'-' +
IntToHex(LoWord(VolumeSerialNumber), 4);
Memo1.Lines.Add(SerialNumber);
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99