一個檢測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;
相關文章
相關標籤/搜索