Tell me, is it possible to play system sounds in a wfp application?

I want to implement the following: when a certain event appears, a warning appears and the system sound "Windows Notify" is played.

1 answer 1

Of course available. Only the set of sounds is not very large:

System.Media.SystemSounds.Asterisk.Play(); System.Media.SystemSounds.Beep.Play(); System.Media.SystemSounds.Exclamation.Play(); System.Media.SystemSounds.Hand.Play(); System.Media.SystemSounds.Question.Play(); 

To play any other sounds (only WAWE) use:

 System.Media.SoundPlayer 
  • I am also interested in such a question, is the warning a standard MessageBox? - Denis Zimbulatov
  • Yes, precisely he. - Jones
  • one
    Well, then everything is easier. Looking through all the overloads of the MessageBox.Show () method, everything will be much easier. Here is an example: MessageBox.Show ("Incorrect domain name input", "Input error", MessageBoxButton.OK, MessageBoxImage.Exclamation); Well, depending on the MessageBoxImage, the system sound is played. It's all quite simple. - Denis Zimbulatov
  • Thanks, great way! - Jones