To obtain the serial number of a drive  

Send By: Q3 Team
Web : http://www.q3.nu
Email: dlib@q3.nu
Date: 23/06/99

Tip accessed 594 times

 


With this function:


 	function GetVolumeID(DriveChar: Char): String;
 	var
 	  MaxFileNameLength, VolFlags, SerNum: DWord;
 	begin
 	  if GetVolumeInformation(PChar(DriveChar + ':\'), nil, 0,
 	     @SerNum, MaxFileNameLength, VolFlags, nil, 0)
 	  then
 	  begin
 	    Result := IntToHex(SerNum,8);
 	    Insert('-', Result, 5);
 	  end
 	  else
 	      Result := '';
 	end;




A call example:


 	Label1.Caption:=GetVolumeId('c');