Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The system broadcasts the DBT_DEVICEARRIVAL device event when a device or piece of media has been inserted and becomes available.
To broadcast this device event, the system uses the WM_DEVICECHANGE message with wParam set to DBT_DEVICEARRIVAL 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
);
hwnd
A handle to a window.
uMsg
The WM_DEVICECHANGE message identifier.
wParam
Set to DBT_DEVICEARRIVAL.
lParam
A pointer to a structure identifying the device inserted. 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.
Return TRUE.
If media is being inserted, the type of device arriving is a volume (the dbch_devicetype member is DBT_DEVTYP_VOLUME) and the change effects the media (the dbcv_flags member is DBTF_MEDIA).
For an example, see Detecting Media Insertion or Removal.
Requirement | Value |
---|---|
Minimum supported client |
Windows XP |
Minimum supported server |
Windows Server 2003 |
Header |
|
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today