Advertisement
Gov_777

Получить номер тома

Sep 11th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.50 KB | None | 0 0
  1. function GetHardDiskSerial(const DriveLetter: Char): string;
  2. var
  3.   NotUsed:     DWORD;
  4.   VolumeFlags: DWORD;
  5.   VolumeInfo:  array[0..MAX_PATH] of Char;
  6.   VolumeSerialNumber: DWORD;
  7. begin
  8.   GetVolumeInformation(PChar(DriveLetter + ':\'),
  9.     nil, SizeOf(VolumeInfo), @VolumeSerialNumber, NotUsed,
  10.     VolumeFlags, nil, 0);
  11.     Result := Format('%s%8.8X',
  12.     [VolumeInfo, VolumeSerialNumber])
  13. end;
  14.  
  15.  
  16.  
  17. procedure TForm1.Button9Click(Sender: TObject);
  18. begin
  19. Edit1.Text:=GetHardDiskSerial('c');
  20. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement