ShowDriveSerialNo shows it with ShowMessage GetDriveSerialNo returns a string. You don't need both.
Get Disk Serial Number (A classic)
AKJo commented: It is useful +2
Procedure ShowDriveSerialNo(Drive : String); // Drive as 'c:' or 'd:', ...
var VolSerNum: DWORD;
Dummy1, Dummy2: DWORD;
begin
if GetVolumeInformation(drive+'\', NIL, 0, @VolSerNum, Dummy1, Dummy2, NIL, 0) then ShowMessage(Format('%.4x:%.4x', [HiWord(VolSerNum), LoWord(VolSerNum)]));
End;
Function GetDriveSerialNo(Drive : String) : String; // Drive as 'x:' ...
var VolSerNum: DWORD;
Dummy1, Dummy2: DWORD;
begin
if GetVolumeInformation(drive+'\', NIL, 0, @VolSerNum, Dummy1, Dummy2, NIL, 0) then Result := Format('%.4x:%.4x', [HiWord(VolSerNum), LoWord(VolSerNum)]);
End;
AKJo 0 Light Poster
AKJo 0 Light Poster
finalist 1 Junior Poster in Training
hingman 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.