1、用GetDriveType可以知道盘的类型
var
i:integer
Drive:char;
DriveType:integer;
Display:string;
begin
for i:=1 to 26 do
begin
Drive:=chr(64+i);
DriveType:=GetDriveType(pchar(Drive+':/'));
{0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive. 2
DRIVE_FIXED The disk cannot be removed from the drive. 3
DRIVE_REMOTE The drive is a remote (network) drive. 4
DRIVE_CDROM The drive is a CD-ROM drive. 5
DRIVE_RAMDISK The drive is a RAM disk. 6
}
Display:='驱动器'+Drive+':';
case DriveType of
0
isplay:=Display+'不存在';
1
isplay:=Display+'找不到根目录';
2
isplay:=Display+'可移动盘';
3
isplay:=Display+'硬盘';
4
isplay:=Display+'网络盘';
5
isplay:=Display+'光驱';
6
isplay:=Display+'虚拟盘';
end;
Memo1.Lines.Add(Display);
end;
end;
2、这个没注意,不过取卷标就是个方法,有卷标就是有光盘
3、取得卷标, 例: GetDiskVolume('c')
function GetDiskVolume(DiskChar: Char):string;
var
DiskID : pDWord;
DiskIPMax, DiskIPFile : dword;
Buffer : array [0..255] of char;
begin
New(DiskID);
GetVolumeInformation(PChar(diskchar+':/'), Buffer, SizeOf(Buffer), DiskID,DiskIPMax,DiskIPFile,nil,0);
//result := inttostr(DiskID^);
result:=Buffer;
dispose(DiskID);
end;