I
import
Unregistered / Unconfirmed
GUEST, unregistred user!
拦截消息WM_DEVICECHANGE即可! //响应该消息
procedure Tform1.WMDEVICECHANGE(var msgx :Tmessage);
const
DBT_DEVICEARRIVAL=$8000;
DBT_DEVICEREMOVECOMPLETE=$8004;
begin
inherited;
case msgx.WParam of
DBT_DEVICEARRIVAL:Caption :='有了!';
DBT_DEVICEREMOVECOMPLETE:Caption :='取走了';
end;
end;
procedure Tform1.WMDEVICECHANGE(var msgx :Tmessage);
const
DBT_DEVICEARRIVAL=$8000;
DBT_DEVICEREMOVECOMPLETE=$8004;
begin
inherited;
case msgx.WParam of
DBT_DEVICEARRIVAL:Caption :='有了!';
DBT_DEVICEREMOVECOMPLETE:Caption :='取走了';
end;
end;