一个检测U盘插入与拔出的函数

消息方法
       申明
procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
        实现
procedure TForm1.WMDeviceChange(var Msg: TMessage); var    myMsg : String; begin   Case Msg.WParam of   32768:     begin       myMsg :='U盘插入';       Label1.Caption:=myMsg     end;   32772:     begin       myMsg :='U盘拔出';       Label1.Caption:=myMsg;     end;   end; end;