Id like to know how to detect when a device has been plugged in, and unplugged, and then mute / unmute the laptops internal speakers
Click or tap on the sound volume icon from the system tray, and then click/tap on the current playback device. The Sound flyout then shows you all the playback audio devices that are available for you to use.
Open Control panel. Click Hardware and Sound and then Click on Sounds. Under Playback tab, right click on the empty area and make sure “Show Disabled Devices” has a check mark on it. If headphones/Speakers are disabled, it will now show up in the list.
In unmanaged code you would listen for WM_DEVICECHANGE in your top level windowproc.
That appears to be the only way to do it in managed code as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With