Speechlib Speech를 사용하여 텍스트 음성 변환 용 응용 프로그램을 만들었습니다. 그것은 윈도우 응용 프로그램과 잘 작동합니다.HRESULT에서 예외 얻기 : Speechlib의 0x8004503A
하지만 같은 코드를 사용하여 Windows 서비스를 만들 때. HRESULT에서 예외 : 그것은 나에게이 오류
함께 System.Runtime.InteropServices.COMException (0x8004503A)을 얻었다 0x8004503A는 SpeechLib.ISpeechVoice.Speak
에서이 내 코드입니다
public partial class LEDPlayService : ServiceBase
{
static int MessageID = 0;
static SpeechLib.SpVoice VoiceObj = new SpeechLib.SpVoice();
static System.Timers.Timer myTimer = new System.Timers.Timer();
protected override void OnStart(string[] args)
{
myTimer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
//This statement is used to set interval to 1 minute (= 60,000 milliseconds)
myTimer.Interval = 60* 1000;
// enabling the timer
myTimer.Enabled = true; ;
myTimer.AutoReset = false;
}
private static void OnElapsedTime(object source, ElapsedEventArgs e)
{
((System.Timers.Timer)source).Stop();
myTimer.Enabled = false; ;
bool result =PlayAudio("Hello prithvi");
((System.Timers.Timer)source).Start();
myTimer.Enabled = true;
// TraceService(""+DateTime.Now.TimeOfDay);
}
public static bool PlayAudio(string text)
{
bool res = false;
try
{
VoiceObj.Speak(text, SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);
res = true;
}
catch(Exception e)
{
TraceService("error in sound........."+e.InnerException+e.Message+" "+e.ToString());
res = false;
}
return res;
}
}
도와주세요 ..
다른 계정으로 서비스를 실행 해 보셨습니까? '오른쪽 클릭 서비스 -> 속성 -> 로그온 탭'- '로컬 시스템 계정'대신 자신의 계정을 사용하십시오. – wal