Wednesday, April 15, 2020

POST FORM from Lazarus-IDE

https://svn.freepascal.org/svn/fpc/tags/release_3_0_0/packages/fcl-web/src/base/fphttpclient.pp

DELPHI HARD DISK SERIAL RETRIEVE PROGRAMMATICALLY:

function GetHardDiskSerial(const DriveLetter: Char): string;
var
  
NotUsed:     DWORD;

  VolumeFlags: DWORD;
  VolumeInfo:  array[0..MAX_PATH] of Char;
  VolumeSerialNumber: DWORD;
begin
  
GetVolumeInformation(PChar(DriveLetter + ':\'),

    nil, SizeOf(VolumeInfo), @VolumeSerialNumber, NotUsed,
    VolumeFlags, nil, 0);
  Result := Format('Label = %s   VolSer = %8.8X',
    [VolumeInfo, VolumeSerialNumber])
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  
ShowMessage(GetHardDiskSerial('c'));

end;

// https://www.swissdelphicenter.ch/en/showcode.php?id=57


https://www.electronicshub.org/electronics-mini-projects-ideas/


LAZARUS HARD DISK SERIAL RETRIEVE PROGRAMMATICALLY:


Remember to include Windows in your uses clause :

function GetVolumeID(DriveChar: Char): String;
//Para obtener el # de serie de un disco
var
  MaxFileNameLength, VolFlags, SerNum: DWord;
  DrivePath : String;
begin
  DrivePath :=  DriveChar + ':\';
  if GetVolumeInformation(PChar(DrivePath), nil, 0,
     @SerNum, MaxFileNameLength, VolFlags, nil, 0)
  then
  begin
      Result := IntToStr(SerNum);
  end
  else
      Result := '';
end;
-------------- next part --------------
  //  https://lists.lazarus-ide.org/pipermail/lazarus/2008-April/035263.html
 //An HTML attachment was scrubbed...
//URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20080429/19f60dfc/attachment-0004.html>


++


No comments:

Post a Comment

Коментар: