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.
Popular Posts
-
Twitter in Indonesia are slowly beginning to much-loved, maybe after a little bored with Facebook, so the netter (especially perhaps the B...
-
USB flash disk that is data storage device that compact, small, easy to read and write but the capacity of thousands of times the size of t...
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.