WinAPI: GetDriveType - 获取磁盘类型

//声明:
GetDriveType(
  lpRootPathName: PChar {磁盘根目录}
): UINT;

//返回值:
DRIVE_UNKNOWN     = 0; {未知}
DRIVE_NO_ROOT_DIR = 1; {可移动磁盘}
DRIVE_REMOVABLE   = 2; {软盘}
DRIVE_FIXED       = 3; {本地硬盘}
DRIVE_REMOTE      = 4; {网络磁盘}
DRIVE_CDROM       = 5; {CD-ROM}
DRIVE_RAMDISK     = 6; {RAM 磁盘}

 
 
 
 
 

 

 
  

//举例:
procedure TForm1.FormCreate(Sender: TObject);
var
  c: Cardinal;
begin
  c := GetDriveType('C:');
  ShowMessage(IntToStr(c)); {3; 说明是本地硬盘}
end;

 
 
 
 
 

 

 
  

你可能感兴趣的:(WinAPI: GetDriveType - 获取磁盘类型)