The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.
Event = (UINT) wParam;
dwData = (DWORD) lParam;
Value |
Meaning |
A request to change the current configuration (dock or undock) has been canceled. | |
The current configuration has changed, due to a dock or undock. | |
A device has been inserted and is now available. | |
Permission is requested to remove a device. Any application can deny this request and cancel the removal. | |
A request to remove a device has been canceled. | |
A device has been removed. | |
A device is about to be removed. Cannot be denied. | |
A device-specific event has occurred. | |
Permission is requested to change the current configuration (dock or undock). | |
The meaning of this message is user-defined. |
Return TRUE to grant a requested action.
Return BROADCAST_QUERY_DENY to deny a requested action.
For devices that offer software-controllable features, such as ejection and locking, the operating system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully.
If the operating system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.
DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED