随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

//声明:
GetVolumeInformation(
  lpRootPathName: PChar;               {磁盘驱动器代码字符串}
  lpVolumeNameBuffer: PChar;           {磁盘驱动器卷标名称}
  nVolumeNameSize: DWORD;              {磁盘驱动器卷标名称长度}
  lpVolumeSerialNumber: PDWORD;        {磁盘驱动器卷标序列号}
  var lpMaximumComponentLength: DWORD; {系统允许的最大文件名长度}
  var lpFileSystemFlags: DWORD;        {文件系统标识}
  lpFileSystemNameBuffer: PChar;       {文件操作系统名称}
  nFileSystemNameSize: DWORD           {文件操作系统名称长度}
): BOOL;

//举例: procedure TForm1.FormCreate(Sender: TObject); var RootPath: array[0..20] of Char; VolName: array[0..255] of Char; SerialNumber: DWORD; MaxCLength: DWORD; FileSysFlag: DWORD; FileSysName: array[0..255] of Char; begin RootPath := 'C:\'; GetVolumeInformation( RootPath, VolName, 255, @SerialNumber, MaxCLength, FileSysFlag, FileSysName, 255 ); Memo1.Clear; with Memo1.Lines do begin Add(Format('磁盘驱动器代码字符串:'+ #9#9 +'%s',[RootPath])); Add(Format('磁盘驱动器卷标名称:'+ #9#9 +'%s',[VolName])); Add(Format('磁盘驱动器卷标序列号:'+ #9#9 +'%s',[IntToHex(SerialNumber,8)])); Add(Format('系统允许的最大文件名长度:'+ #9 +'%d',[MaxCLength])); Add(Format('文件系统标识:'+ #9#9#9 +'%d',[FileSysFlag])); Add(Format('文件系统名称:'+ #9#9#9 +'%s',[FileSysName])); end; end;
//效果图:

posted on 2008-02-11 16:26  万一  阅读(...)  评论(...编辑  收藏