Device Removal Notification

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

If the user removes a Plug and Play device that the graph was using, the filter graph manager posts an EC_DEVICE_LOST event. If the device becomes available again, the filter graph manager posts another EC_DEVICE_LOST event. However, the previous state of the capture filter is no longer valid. The application must rebuild the graph to use the device.

DirectShow does not send any event when a new device is plugged in. To learn when a new device is available, the application can monitor WM_DEVICECHANGE window messages. For more information, see "Device Management" in the Platform SDK documentation.

Event Notification in DirectShow