I developed a speech recognition program using SpSharedRecoContext.
The program works but is too slow. I thought I would change the program to use
SpInProcRecoContext which should provide better performance and quality. I expected
the change to be easy with some necessary tweeks.
However, I have encountered a problem that I can not understand.
I can demonstrate the problem with the following:
Imports SpeechLib
Dim WithEvents RC As SpInProcRecoContext
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
RC = New SpInProcRecoContext '---- This line causes the following runtime exception:
End Sub
End Class
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147201021
Message=Creating an instance of the COM component with CLSID {73AD6842-ACE0-45E8-A4DD-8795881A2C2A} from the IClassFactory failed due to the following error: 80045003.
Source=WindowsApplication25
StackTrace:
at WindowsApplication25.Form1.Form1_Load(Object sender, EventArgs e) in c:\users\chuck\documents\visual studio 2010\Projects\WindowsApplication25\WindowsApplication25\Form1.vb:line 7
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
80045003 error is un SPERR_UNSUPPORTED_FORMAT ;"The caller has specified an unsupported format. "
If I change it to the following using SpSharedRecoContext, I get no runtime errors, and was the bases for
my Speech Recognition programs that is working.
Imports SpeechLib
Dim WithEvents RC As SpSharedRecoContext
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
RC = New SpSharedRecoContext
End Sub
End Class
I have researched and have found that others have had similar problems
with SpInProcRecoContext, but I found no solutions.
I am running Windows 8 on the development system with Visual Studio 2010. Based on information,
I read on line, I removed and reinstalled Visual Studio 2010 and SDK . I took the
runtime and tried it on a Windows 7 system, with the same results. I download the trial
Visual Studio 2012 and got the same error. I have seen very similar code
on the Microsoft web site, so I don't think the issue is with the code.
However, the Microsoft example Set RC = New SpInProcRecoContext Set is used. When I include Set, VB
removes the Set from the code. I am not sure what that is about.
Can anyone provide me some insight on this problem? Thanks