{获取C盘的卷标 格式化硬盘卷标改变}
//GetHardDiskSerial('c:\')
function GetHardDiskSerial(Drive: string): string;
var VolumeSerialNumber: DWORD;
MaximumComponentLength: DWORD;
FileSystemFlags: DWORD;
begin
if Drive[Length(Drive)]=':' then Drive := Drive + '\';
GetVolumeInformation(PChar(Drive), nil, 0, @VolumeSerialNumber, MaximumComponentLength, FileSystemFlags, nil, 0);
Result := IntToHex(HiWord(VolumeSerialNumber), 4) + '-' + IntToHex(LoWord(VolumeSerialNumber), 4);
end;
相关文章
- 12-27delphi 获取驱动盘的卷标 号