WM_DEVICECHANGE  199JO11 

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;
 

Parameters

Event

Event type. This parameter can be one of the following values:

Value

Meaning

DBT_CONFIGCHANGECANCELEDJMDO2A

A request to change the current configuration (dock or undock) has been canceled.

DBT_CONFIGCHANGED1HILUDM

The current configuration has changed, due to a dock or undock.

DBT_DEVICEARRIVAL4IS8ZQ

A device has been inserted and is now available.

DBT_DEVICEQUERYREMOVE_OMNVS

Permission is requested to remove a device. Any application can deny this request and cancel the removal.

DBT_DEVICEQUERYREMOVEFAILED75EFJX

A request to remove a device has been canceled.

DBT_DEVICEREMOVECOMPLETE1ZK9FW5

A device has been removed.

DBT_DEVICEREMOVEPENDINGIRGJXC

A device is about to be removed. Cannot be denied.

DBT_DEVICETYPESPECIFICQLUFGG

A device-specific event has occurred.

DBT_QUERYCHANGECONFIGWDJB1D

Permission is requested to change the current configuration (dock or undock).

DBT_USERDEFINED12ZC6NZ

The meaning of this message is user-defined.

 

dwData

Address of a structure that contains event-specific data. Its meaning depends on the given event.

 

Return Values

Return TRUE to grant a requested action.

Return QUERY_BROADCAST_DENY to deny a requested action.

Remarks

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_CONFIGCHANGECANCELEDJMDO2A, DBT_CONFIGCHANGED1HILUDM, DBT_DEVICEARRIVAL4IS8ZQ, DBT_DEVICEQUERYREMOVE_OMNVS, DBT_DEVICEQUERYREMOVEFAILED75EFJX, DBT_DEVICEREMOVECOMPLETE1ZK9FW5, DBT_DEVICEREMOVEPENDINGIRGJXC, DBT_DEVICETYPESPECIFICQLUFGG, DBT_QUERYCHANGECONFIGWDJB1D, DBT_USERDEFINED12ZC6NZ