How to play a standard windows sound?

后端 未结 3 882
难免孤独
难免孤独 2020-12-16 17:48

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

Example: I want to play the sound for \"Device connected\".

Which API can b

相关标签:
3条回答
  • 2020-12-16 18:02

    PlaySound is the API ,also see Play System Sounds

    0 讨论(0)
  • 2020-12-16 18:12

    Not Win32, but for .net anyway, you can do this using the following in C#:

    System.Media.SystemSounds.Asterisk.Play();
    // Plays the Asterisk sound (used for Information (i))
    // Also available:
    // Exclamation (Warning /!\)
    // Hand (aka Critical Stop - Error (X))
    // Question (?)
    // Beep (aka Default Beep)
    
    0 讨论(0)
  • 2020-12-16 18:15

    Take a look at these articles:

    Playing .wav files using C#

    Creating Your Own Sound Alerts

    0 讨论(0)
提交回复
热议问题