<p>How do I find out which sound files the user has configured in the control panel?</p>

<p>Example: I want to play the sound for "Device connected".</p>

<p>Which API can be used to query the control panel sound settings?</p>

<p>I see that there are some custom entries made by third party programs in the control panel dialog, so there has to be a way for these programs to communicate with the global sound settings.</p>

<p>Edit: Thank you. I did not know that PlaySound also just played appropriate sound file when specifying the name of the registry entry.</p>

<p>To play the "Device Conntected" sound:</p>

<pre><code>::PlaySound( TEXT("DeviceConnect"), NULL, SND_ALIAS|SND_ASYNC );
</code></pre>

[{'answer_id': 72250, 'author': 'titanae', 'author_id': 2387, 'author_profile': 'https://Stackoverflow.com/users/2387', 'pm_score': 5, 'selected': True, 'text': '<p><a href="https://learn.microsoft.com/en-us/previous-versions/ms712879(v=vs.85)" rel="nofollow noreferrer"><code>PlaySound</code></a> is the API.</p>\n<p>Also see <a href="https://learn.microsoft.com/en-us/windows/win32/multimedia/using-playsound-to-play-system-sounds" rel="nofollow noreferrer">Play System Sounds</a>.</p>\n'}, {'answer_id': 72488, 'author': 'Nidonocu', 'author_id': 483, 'author_profile': 'https://Stackoverflow.com/users/483', 'pm_score': 4, 'selected': False, 'text': '<p>Not Win32, but for .net anyway, you can do this using the following in C#:</p>\n\n<pre><code>System.Media.SystemSounds.Asterisk.Play();\n// Plays the Asterisk sound (used for Information (i))\n// Also available:\n// Exclamation (Warning /!\\)\n// Hand (aka Critical Stop - Error (X))\n// Question (?)\n// Beep (aka Default Beep)\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/72167', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1810/']