Playing system sounds from custom sound scheme RRS feed

  • Question

  • I'm trying to play an audio file from an event defined in a sound scheme. Each scheme has different categories.. there's Windows which are the default sounds, and then depending on what apps you have installed, there can be more categories (e.g. Visual Studio if you have visual studio installed, or Lync if you have the Lync client installed).

    I've wrapped the sndPlaySoundW W32API as outlined here:

    That works fine for all the events defined under Windows... e.g.

    bool retval = sndPlaySoundW("MailBeep", SND_NODEFAULT | SND_ALIAS);

    gives me the new mail sound. However, if I try to play a sound from another category (e.g. FaxSent), the method just returns false. So, other than accessing the registry to find the actual path of the file, how do I get to play sounds defined for other components (for the moment I'm focused on Windows Explorer, but in the end I want to create my own category and define my own sounds and play them from my application without having to worry about their location).

    And while we're at it.. does somebody know how to make your own events and categories show up for all users?

    • Moved by Paul Zhou Tuesday, August 2, 2011 10:00 AM (From:.NET Base Class Library)
    Wednesday, July 13, 2011 10:11 AM

All replies

  • Just to be sure, does the current soundscheme specify a sound for FaxSent? When SND_NODEFAULT is specified it will not try to play the default and return false.
    Wednesday, July 13, 2011 1:32 PM
  • The sndPlaySound() function offers a subset of PlaySound() and is maintained for backwards compatibility (as read @  Use PlaySound() instead and pass SND_ALIAS_ID.
    Wednesday, July 13, 2011 2:07 PM
  • I'm currently on "Windows Default (modified)". If I check HKEY_CURRENT_USER\AppEvents\Schemes\Names, the .Modified contains "Windows Default (modified)".. so that's what I'm looking at.

    Under HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\FaxSent\.Modified I do have a valid WAV file. The same can be said for the .Current and .default scheme for the FaxSent event. .Current/.default have the path written a bit differently (no idea why... they have C:\Windows\media whereas all other schemes have C:\Windows\Media but since upper/lower case doesn't matter on Windows, this shouldn't be an issue).

    Thursday, July 14, 2011 1:45 PM
  • Hi Stephan,

    I suggest you post thread in  General Windows Development Issues to get better support.

    Thank you for your posting and understanding.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 15, 2011 5:25 AM