Click here to Skip to main content
13,041,923 members (84,269 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
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.
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)

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
Posted 19-Feb-13 7:03am
Updated 19-Feb-13 7:45am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why using SpeechLib, if you can use System.Speech.Recognition,[^]?

Use either System.Speech.Recognition.SpeechRecognizer or System.Speech.Recognition.SpeechRecognitionEngine, see the code samples. I worked with both, they work. You will find code sample on the MSDN help pages for these classes:[^],[^].

They have slightly different features and are designed for STA and MTA thread apartment states, so if your application uses different apartment state (for example, WPF only works with STA), you will need to use a separate thread for recognition. They are using the same engine, anyway.

The assembly "System.Speech.dll" is installed in GAC, so you reference it through the tab ".NET" of the VS "Add reference" window.

Good luck,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100