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





Article #17246: How can I get serial number of my drive

 Question and Answer Database

FAQ2246D.txt   How can I get serial number of my drive
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How can I get volume information, such as the serial number,
from my drivers?


Answer:
procedure TForm1.Button1Click(Sender: TObject);
var
  VolumeName,
  FileSystemName     : array [0..MAX_PATH-1] of Char;
  VolumeSerialNo     : DWord;
  MaxComponentLength,
  FileSystemFlags    : Integer;
begin
  GetVolumeInformation('C:\',VolumeName,MAX_PATH,@VolumeSerialNo,
                       MaxComponentLength,FileSystemFlags,
                       FileSystemName,MAX_PATH);
  Memo1.Lines.Add('VName = '+VolumeName);
  Memo1.Lines.Add('SerialNo = $'+IntToHex(VolumeSerialNo,8));
  Memo1.Lines.Add('CompLen = '+IntToStr(MaxComponentLength));
  Memo1.Lines.Add('Flags = $'+IntToHex(FileSystemFlags,4));
  Memo1.Lines.Add('FSName = '+FileSystemName);
end;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99