
CAppSoundsManager v1.02 An MFC
class to encapsulate Application Sounds
Welcome to CAppSoundsManager, an MFC class which encapsulates the area of
"Application Sounds". These are the sounds which end-users can customize in the
Sound tab of the "Sounds and Audio Devices" control panel applet. The class is
based in part upon the "CSoundMgr" class developed by Paul DiLascia for the May
2006 edition of the MSDN Magazine
To get you started you should probably read the DiLascia article at
http://msdn.microsoft.com/msdnmag/issues/06/05/CAtWork/
The enclosed zip file contains
the source and a sample VC 8 dialog based appwizard generated application to show how to use it.
Features
- Implements a simple easily maintainable MAP based approach to application
sounds.
- Implementations registration and un-registration methods through code
- Unlike the DiLascia implementation which requires the end user to create
logical names as well as registry names in addition to the sound id for each
application sound you want to set up, CAppSoundsManager only requires that
you setup one id and figures out all the other values from this by looking
in your application's resources.
- Whether or not specific sounds should be played from resources if they
are not setup can be individually configured.
- Unlike the DiLascia implementation, the code does not use
AfxGetAppName() for the filename for registration. This approach would cause
problems if the Application name is different than you exe filename.
- Supports the "DispFileName" registry entry for both Application names
and individual sounds. This allows the code to work on MUI builds unlike the DiLascia
implementation. For further information on this and Application Sound
registration details, please see Larry Osterman's WebLog at
http://blogs.msdn.com/larryosterman/archive/2006/01/24/517183.aspx.
- Works equally well in Unicode
as well as ASCII builds.
- Automatically links to the
Windows Multimedia library namely "Winmm.lib"
- Include in the download is the AppSoundsManager modules along with a VC
8 project to build a test app to exercise most of the classes functionality.
- Supports registration of file system based sounds.
- Supports the concept of disabled sounds.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
Updates
v1.0 (22 September 2006)
V1.01 (22 September 2006)
- The existing APP_SOUND macro has been renamed to APP_SOUND_FROM_RESOURCE.
- Now supports registration of file based wave files using the
APP_SOUND_FROM_FILE macro.
- Now supports the concept of a disabled sound, where the sound will only
be played if the end-user configures the value in the control panel through
the new APP_SOUND_DEFAULT_NONE macro.
V1.02 (14 June 2007)
- Updated Register and UnRegister methods to preserve last error code if it
cannot open the "HKCU\AppEvents\EventLabels" registry key.
- Updated copyright details.