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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get Hard disk number with Delphi ??

Status
Not open for further replies.

Lemonade

Programmer
Sep 1, 2002
6
ID
Hello :)

Please help me , how to get hard disk number with delphi :)

Thanks,

Lemonade
 
function SerialNum(Fdrive: string): string;
var
Serial, DirLen, Flags: Dword;
DLabel: array[0..11] of char;
begin
try
GetVolumeInformation(Pchar(Fdrive+':\'),DLabel,12,@Serial,DirLen, Flags, nil, 0);
Result := IntToHex(Serial,8);
except
Result := '';
end;
end;


Usage:
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption := 'Drive serial = ' + SerialNum('c');
end; Steven van Els
SAvanEls@cq-link.sr
 
Steven your example gives VOLUME's serial number not HDD's one.

--- markus
 
Your right, I didn't noticed it. Steven van Els
SAvanEls@cq-link.sr
 
Please go to and find one of the many systeminfo components, some with source included, and take your pick...

HTH, TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top