Vista上Windows服务中的Soundplayer类 [英] Soundplayer Class in Windows Service on Vista
问题描述
受保护的 Hi, protected 覆盖 void OnStart( 字符串 []参数) override void OnStart(string[] args) 这篇关于Vista上Windows服务中的Soundplayer类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
在Vista上使用VS2005中开发的C#Windows服务中的soundplayer类时,我遇到了问题.在XP上,一切正常.
我已减少了播放"C:\ tada.wav"的代码.如下所示启动服务时的文件.
I have a problem using the soundplayer class from a C# Windows Service developed in VS2005 on Vista. On XP everything works fine.
I have reduced the code to play the "C:\tada.wav" file when the service is started like below.
{
//待办事项:在此处添加代码以开始您的服务.
SoundPlayer m_soundPlayer = new SoundPlayer ( " C:\\ tada.wav" );
m_soundPlayer.Play();
}
在XP上,服务启动时会播放声音,但在Vista上则没有任何反应,没有错误,也没有声音.如果我在正常形式的应用程序中使用Soundplayer类,那么它也可以在Vista上运行,但是我需要使其作为服务运行.
/每
{
// TODO: Add code here to start your service.
SoundPlayer m_soundPlayer = new SoundPlayer("C:\\tada.wav");
m_soundPlayer.Play();
}
On XP the sound is played when the service is started but on Vista nothing happens, no error and no sound. If I use the Soundplayer class in a normal form application then it works on Vista as well, but I need to have it running as a service.
Has anyone run into the same problem or has anyone any solution??
/Per
推荐答案
您使用哪个凭证来运行服务?如果这是本地系统,也许您应该尝试其他帐户.
Which credentials do you use to run the service? If this is local system, maybe you should try a different account.