Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get Hard Disk Serial Number?

Status
Not open for further replies.

Gigatech

Programmer
Jul 12, 2000
80
CR
Delphi 5. How can I get an unique number for a specific PC, for example HDD Serial Number or Motherboard serial number?<br>Thanks.
 
Try this...<br><br>function GetVolumeSerialNumber: string;<br>var<br>&nbsp;&nbsp;NotUsed, VolFlags: DWORD;<br>&nbsp;&nbsp;VolSN: DWORD;<br>&nbsp;&nbsp;VolumeSerialNumber: string;<br>begin<br>&nbsp;&nbsp;&nbsp;&nbsp;SetCurrentDirectory(pChar(ExtractFilePath(Application.ExeName)));<br>&nbsp;&nbsp;&nbsp;&nbsp;GetVolumeInformation(nil, nil, 0, @VolSN, NotUsed, VolFlags, nil, 0);<br>&nbsp;&nbsp;&nbsp;&nbsp;VolumeSerialNumber := AnsiUpperCase(IntToHex(VolSN, 8));<br>&nbsp;&nbsp;&nbsp;&nbsp;Result := Copy(VolumeSerialNumber, 1, 4) + '-' + Copy(VolumeSerialNumber, 5, 4);<br>end;<br> <p>Paul Wesson<br><a href=mailto:paul@wessoft.com>paul@wessoft.com</a><br><a href= Wesson, Programmer/Analyst</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top