Page 1 of 1

[Delphi] Get hwid in delphi

Posted: 24 Dec 2010, 15:53
by djfshady
First add 1 label then

add this code after an

Code: Select all

end;
on your form.

Code: Select all

function getHWID(): String;
var
SerialNum,A,B: DWord;
C: array [0..255] of Char;
Buffer: array [0..255] of Char;
begin
if GetVolumeInformation(pChar('C:\'), Buffer, 256, @SerialNum, A, B, C, 256) then
  Result := inttostr(SerialNum * Cardinal(-1))
else Result := '';
end;
next add this code by double clicking your form name.

Code: Select all

label1.caption := GetHwid();