The C# team posts answers to common questions and describes new language features
Sometimes, you might want to make your application a bit more audible. If you are using .NET 2.0, you can utilize the new System.Media namespace and its SystemSound and SystemSounds classes.
The SystemSounds class contains five static properties that you can use to retrieve instances of the SystemSound class. This class in turn contains the Play() method, which you can use to play the wave file associated with the sound in Windows Control Panel. Note that the user can also disable all sounds altogether, which would mean that no sound can be heard through the computer speakers.
To play for example the classical beep sound, you could use the following code:
Similarly, you could play the “Question” sound with this code:
The System.Media namespace is defined in System.dll, so there are no new DLLs you would need to add to your project’s references to use the above code.
[author: Jani Järvinen, C# MVP]
Easy Notifications with System.Media.SystemSounds
PingBack from http://blog.f9group.com/technology/c/how-do-i-play-default-windows-sounds/
Hi. I know this article is old, but very helpful. Thanks for all!!
Is system.media in vs2023 for windows phone expree
i didn't know it could be that much easy.
plz tell me when i take my computer it having a system speaker and it play music everything but when i do new window the system sound did not work and did not play any sound like music and everything but headphone and speaker is working but system sound did not work plzzzzz solve my problem plzzzzzzzzzzzzzzz