UINT GetDriveType( LPCTSTR lpRootPathName // address of root path );Value Meaning 0 The drive type cannot be determined. 1 The root directory does not exist. DRIVE_REMOVABLE The drive can be removed from the drive. DRIVE_FIXED The disk cannot be removed from the drive. DRIVE_REMOTE The drive is a remote (network) drive. DRIVE_CDROM The drive is a CD-ROM drive. DRIVE_RAMDISK The drive is a RAM disk.
可以用消息,给你贴一段zswang兄的://思路是监测驱动器的改变~~ //插来插去,测试了一下,得到的数值~~type TForm1 = class(TForm) Memo1: TMemo; private { Private declarations } procedure WMDEVICECHANGE(var Msg: TMessage); message WM_DEVICECHANGE; //驱动器改变 public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMDEVICECHANGE(var Msg: TMessage); begin inherited; case Msg.WParam of 32772: Caption := '关闭'; 32768: Caption := '就绪'; end; end;
);Value Meaning
0 The drive type cannot be determined.
1 The root directory does not exist.
DRIVE_REMOVABLE The drive can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.
//插来插去,测试了一下,得到的数值~~type
TForm1 = class(TForm)
Memo1: TMemo;
private
{ Private declarations }
procedure WMDEVICECHANGE(var Msg: TMessage); message WM_DEVICECHANGE; //驱动器改变
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMDEVICECHANGE(var Msg: TMessage);
begin
inherited;
case Msg.WParam of
32772: Caption := '关闭';
32768: Caption := '就绪';
end;
end;