Platform SDK: Hardware |
The system broadcasts the DBT_DEVICEQUERYREMOVE device event to request permission to remove a device. This message is the last chance for applications and drivers to prepare for the removal of the device. However, any application can deny this request and cancel the device removal.
To broadcast this device event, the system uses the WM_DEVICECHANGE message with wParam set to DBT_DEVICEQUERYREMOVE and lParam set as described following.
Return TRUE to grant permission to remove a device.
Return BROADCAST_QUERY_DENY to deny permission to remove a device.
On Windows NT/Windows 2000, you must close all handles to the device or the device removal will fail. This is not a requirement on Windows 95/98, but it is a good rule to follow and it should increase reliability.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Dbt.h.
Device Management Overview, Device Management Events, DEV_BROADCAST_HDR, WM_DEVICECHANGE