I have a WinForms app. This app has a Preferences section where the user will be able to select which sounds are played when an alert is being displayed.
Is it possible to have a combobox where the user can select from the Windows stored sounds such as "critical stop", "critical beep" and so on. These are found in the "Control Panel" >> "Sounds and Alerts" section.
Is it also possible to have a play button to test the sounds out?
You can either right-click the speaker icon in your notification area, and then select “Open Sound Settings” or navigate to Settings > System > Sound. In the Sound settings, scroll down to the “Other Sound Options” section, and then click the “App Volume And Device Preferences” option.
Open File Explorer or Windows Explorer and navigate to the following path: C:\Windows\Media. Scroll down past the folders until you see the individual sounds. Each sound is saved as a WAV file, which means you can play it in Windows Media Player or a similar audio player.
In Windows 10, open the Start menu, and scroll down to the "W" section to find Windows Media Player. Once it is running, select Open from the file menu, then browse to the location of the audio file. Alternatively, you can drag-and-drop the audio file onto Windows Media Player.
You do not require any API to play system sounds just write code like this:
// Plays the sound associated with the Asterisk system event.
System.Media.SystemSounds.Asterisk.Play();
The SystemSounds
class contains the following predefined system sounds:
All other sounds require you read the desired sound from the registry and play it with code like this:
SoundPlayer simpleSound = new SoundPlayer(@"c:\Path\To\Your\Wave\File.wav");
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