unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
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);
var myMsg:String;
begin
showmessage(IntToStr(msg.WParam));
Case Msg.WParam of
32768:
begin
myMsg:='U盘插入';
showmessage(myMsg);
end;
32772:
begin
myMsg:='U盘拔出';
showmessage(myMsg);
end;
end;
end;
end.
U盘插入拔出检测
最新推荐文章于 2024-06-17 14:03:38 发布