Procedure TUSBDeviceNotifier.WMDeviceChange(var amsg: TMessage);
begin
case amsg.WParam of
DBT_DEVICEARRIVAL:
DoDeviceArrival(PDevBroadcastHdr(amsg.LParam));
DBT_DEVICEREMOVECOMPLETE:
DoDeviceRemoveComplete(PDevBroadcastHdr(amsg.LParam));
end;
end;
To obtain more specific information, you can do a typecastDEV_BROADCAST_HDR structure to another structureaccording to type of device type that you monitor. Since we useDBT_DEVTYP_DEVICEINTERFACE, then we can typecast thelParam DEV_BROADCAST_DEVICEINTERFACE.
All About Pascal Delphi And Applied
Popular Posts
-
The first Pascal compiler was designed in Zürich for the CDC 6000 series mainframe computer family. Niklaus Wirth reports that a ...
-
Actually according to MSDN, this WM_DEVICECHANGE sent to all top-level window when there are changes to the device on the PC. However, Windo...
Monday, January 2, 2012
Processing WM_DEVICECHANGE
Each time a USB device configuration changes, the window which you registered will receive a message on message queue WM_DEVICECHANGE. Where wParam will be filled with the types of events and lParam contains a pointer to a data structure DEV_BROADCAST_HDR. The following code is an example of how to handle this message.
Subscribe to:
Posts (Atom)