How do I add "trappable" events to the Control Panel's "Sounds" applet? For example, I'd like to add
sounds to a whole lot more messages than there currently is in Win95 -- ie, moving, resizing windows,
deleting or copying files from Explorer, creating folders, dragging items to the desktop, etc.
Basically I'd like to have the liberty of trapping any WM_* message and adding it to the "Sound
Properties" in Control Panel so I can add events to it.
Another example - CompuServe's WinCIM plays a WAV file when you receive some new mail - I'd like to
add that message to Control Panel so I can associate a different sound to it...
I know, it's all gimmicks, but some people like the ability to add some customization...
Thanks for any help.
--
#ifndef __SIG_H
#define __SIG_H
class CReplyTo {
private:
char pszRealName[] = "Daniel Desormeaux";
char pszCompuServe[] = "10213...@compuserve.com";
public:
char pszInternet[] = "dan...@magi.com";
char pszWebPage[] = "http://www.magi.com/~danield/";
} ;
#endif
>Obviously there's a way to do this, and it's through the registry... Here goes...
>
>How do I add "trappable" events to the Control Panel's "Sounds" applet? For example, I'd like to add
>sounds to a whole lot more messages than there currently is in Win95 -- ie, moving, resizing windows,
>deleting or copying files from Explorer, creating folders, dragging items to the desktop, etc.
>
>Basically I'd like to have the liberty of trapping any WM_* message and adding it to the "Sound
>Properties" in Control Panel so I can add events to it.
>
>Another example - CompuServe's WinCIM plays a WAV file when you receive some new mail - I'd like to
>add that message to Control Panel so I can associate a different sound to it...
>
>I know, it's all gimmicks, but some people like the ability to add some customization...
>
>Thanks for any help.
Two things:
1. To intercept the appropriate messages, set up a hook using the
SetWindowsHookEx() function. The hook procedure must go in a DLL,
since it can be called from within the context of any process. Look up
SetWindowsHookEx() in your Win32 reference for details.
2. To make your events appear in the "Sounds" Control Panel applet,
simply add the appropriate subkeys under the following keys:
a. HKEY_CURRENT_USER\AppEvents\Schemes\Apps
This key is arranged hierarchically by program. If your event only
occurs within the context of a specific program (e.g. Eudora), create
a separate key for that program; otherwise, put your event keys under
the ".Default" key.
b. HKEY_CURRENT_USER\AppEvents\EventLabels
This key is optional, and stores the human-readble descriptions for
each event.
So far so good? Let me give an example:
Say you want your app to support a "move window" sound. The first
thing you'll want to do is have it intercept the appropriate window
message (WM_SYSCOMMAND, wParam == SC_MOVE) from within your DLL's hook
procedure.
Next, create the following key in the Registry:
HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\Move
Then create the following key:
HKEY_CURRENT_USER\AppEvents\EventLabels\Move
And under this key, set the default (string) value to "Move window".
Your new event should now appear in the "Sounds" Control Panel applet.
Of course, now you'll have to make your DLL smart enough to read the
settings from the Registry. At any given time, the *current* setting
(*.WAV filename, if any) for your "Move" event will be stored under
the following key:
HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\Move\.current
That's it! Whenever the event is intercepted, play the sound.
See the existing keys in your own Registry for the exact format and
for more details (it's simple, and mostly self-explanatory). Or write
me back if you need a more detailed explanation from me. Heck, how do
I know all this in the first place? From looking at the Registry
myself! ;-)
BCNya,
Edward
-----------------------------------------------------------
J. Edward Sanchez <je...@tridel.com.ph>
http://www.tridel.com.ph/softarts/ (The SoftArts Home Page)
http://www.tridel.com.ph/user/jess/ (Edward's Place)
-----------------------------------------------------------