//聲明: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;
//效果圖: