我刚刚阅读了这个问题,我真的很喜欢这个问题的答案。 自然,一个有趣的问题突然出现在我的脑海中。
如何在控制面板->声音和音频设备->声音->程序事件中添加我自己的事件(属于我自己的应用程序)?
我想在这里也要回答的另一个相关问题是...
当应用程序中的事件发生时,如何播放"控制面板"中指定的声音?
与Google的一段优质时光使我撰写了CodeProject文章,名为"创建自己的声音警报"。 似乎所有的秘密都在HKEY_CURRENT_USER\\AppEvents注册表项的下面。
从文章:
Ok, it was very easy to create new Sound Alert Scheme. Now let us move to add our own Sound Alert Type in the sounds. For that follow these steps.
Create a new Key under HKEY_CURRENT_USER\\AppEvents\\Schemes\\App.Default and name that XYZAlert
Create another key under the key XYZAlert (the key you have created in above step) and name that .default
Set the default value of the .default key to path of some .wav file. eg. C:\\abc\\abc.wav
Create another key under XYZAlert and name that to .current and also set the path to some wav file, or leave that blank.
Now Create another key under HKEY_CURRENT_USER\\AppEvents\\EventLabels and name that XYZAlert
Set the default value of this key to anything like"XYZ Alert Here."
That's finish. Now go to your control panel and start the sounds applet. You will see the new sound alert type with name XYZ Alert.
请注意,您还必须使用" PlaySound"本地调用来播放声音。