本文整理自网络,侵删。
{获得磁盘驱动器序列号}
function Get_HD_Serial(const Drivedir: Char): string; var Nu: DWORD; Vf: DWORD; VolumeInfo: array[0..MAX_PATH] of Char; V_n: DWORD; begin GetVolumeInformation(PChar(Drivedir + ':\'), nil, SizeOf(VolumeInfo), @V_n,Nu, Vf, nil, 0); Result := Format('%x-%x',[HiWord(V_n),LoWord(V_n)]); // Result := Format('%8.0X', [V_n]) end; //格式化硬盘卷标ID号会改变
调用
Caption:=Get_HD_Serial('c') ;
相关阅读 >>
Delphi 取出鼠百标点击的 stringgrid 中某单度元格的值
Delphi monthoftheyear、weekoftheyear、weekofthemonth、dayoftheyear … 相对时间
Delphi xe8在firemonkey tlistbox中显示图像
更多相关阅读请进入《Delphi》频道 >>