The system broadcasts the DBT_DEVICEREMOVEPENDING device event when a device or piece of media is being removed and is no longer available for use.
To broadcast this device event, the system uses the WM_DEVICECHANGE message with wParam set to DBT_DEVICEREMOVEPENDING and lParam set as described following.
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_DEVICECHANGE WPARAM wParam, // device-change event LPARAM lParam // event-specific data );
A handle to a window.
The WM_DEVICECHANGE message identifier.
Set to DBT_DEVICEREMOVEPENDING.
A pointer to a structure identifying the device. The structure consists of an event-independent header, followed by event-dependent members that describe the device. To use this structure, treat the structure as a DEV_BROADCAST_HDR structure, then check its dbch_devicetype member to determine the device type.
The system may broadcast a DBT_DEVICEREMOVEPENDING message without sending a corresponding DBT_DEVICEQUERYREMOVE message. In such cases, the applications and drivers must recover from the loss of the device as best they can.
For an example, see Processing a Request to Remove a Device.
Minimum supported client
Minimum supported server
|Windows Server 2003|