Click here to Skip to main content
Licence 
First Posted 30 Jan 2004
Views 22,609
Bookmarked 12 times

Integration with Shell Sound Events

By | 30 Jan 2004 | Article
This article describes how to modify entries in registry, in order to register our own sound events.

Introduction

I wanted to register my own and new sound events in shell (see Control Panel, Sounds) for my new application, and I found out there is no API for this. At least, I did not find it. So, I had to discover what should be modified in registry.

Using the code

The code is rather clear, and I used it with success. Works for Unicode too! The idea is that there exists a single class which creates valid entries in registry. Also, this class associates given entry with some unique identifier, and allows to play desired sound on event.

First, valid entries in registry must be created. TSystemSoundMgr::CreateEntriesInRegistry() is used for this. Once registered, we should call TSystemSoundMgr::PlaySoundOnEvent(UINT) and pass event identification.

This class will not play sounds by itself. So, it is up to the programmer to call PlaySoundOnEvent method.

TSystemSoundMgr uses also CRegistryTools. Now I have to apologize, because for sure this class comes from CodeTools, and I do not remember who is the author. It is also probable that I have made some changes to this code (probably about Unicode compilation).

History

It is possible to write more objective code, by using for example map of ID to string, so that in TSystemSoundMgr we would not have to switch by ID, but only search for ID in map. Also method implementation is not consistent, because in one place, I use CRegistryTools, and in the second, I use RegistryAPI directly. Anyway, this is the first version, and I am waiting for comments :)

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Mukkie

Business Analyst

Poland Poland

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralFrom Microsoft PinmemberAndyCLon14:19 16 Mar '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 31 Jan 2004
Article Copyright 2004 by Mukkie
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid