code doesn't run (on an XP machine)?
I am trying to use MS Speech SDK in Visual Basic. Can you see why this
> code doesn't run (on an XP machine)?
> The code compiles OK and the form comes up when I run the app but I
> don't even get my first print statement (Label1.Text = "Form Loaded").
>
> Option Explicit Off
>
> Imports SpeechLib
>
> Public Class Form1
> Public WithEvents RC As SpSharedRecoContext
> Public myGrammar, b As ISpeechRecoGrammar
>
> Private Sub Form1_Load()
> RC = New SpSharedRecoContext
> Label1.Text = "Form Loaded"
> myGrammar = RC.CreateGrammar
> myGrammar.CmdLoadFromFile("e:\SolApp\sol.xml", SLODynamic)
> myGrammar.CmdSetRuleIdState(0, SGDSActive)
> Label1.Text = "Grammar Loaded"
> End Sub
Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Text = "(no recognition)"
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal RecognitionType As
SpeechLib.SpeechRecognitionType, ByVal Result As
SpeechLib.ISpeechRecoResult)
Label1.Text = Result.PhraseInfo.GetText
End Sub
End Class
Re: code doesn't run (on an XP machine)?
When you say 'its not running on XP machine'..is it working fine on another environment? BTW, what is SpSharedRecoContext? Do you have reference added to this object?
Re: code doesn't run (on an XP machine)?
Re: code doesn't run (on an XP machine)?
hi .....
thanks for quick reply...
i added MS Speech SDK 5.1 from microsoft web.. really im not a vb programmer... i typed this in vb.net .. but there were no error msgs..... and this is for my friends final year project codes...
please reply me..
thank you
Re: code doesn't run (on an XP machine)?
Hmmm... so you are putting in efforts for your friend eh?! Must be a girl friend or a boy friend ;)
Anyway, you didnt reply to my question. Does it work in any other environment - other than Windows XP?
One more question - does your application hang after loading the form?
Try debugging the application by putting a break point at form load event.
All the best
Re: code doesn't run (on an XP machine)?
You're not a VB programmer yet you're doing this for your friend's final year project? What has your friend been doing for the duration of the course? It's not really appropriate that we help you help your friend cheat on their final year project.
Re: code doesn't run (on an XP machine)?
:thumb: hi...
its not for girl hehe.. but really its very big helpto me....
noo i didnt run it on XP.. he sent to me this error and i passed it to forums.. but actually i dont know this code is vb or vb.net .....just i paste this in vb.net and checked.. only this codes work...
Option Explicit Off
Imports SpeechLib
Public Class Form1
Public WithEvents RC As SpSharedRecoContext
Public myGrammar, b As ISpeechRecoGrammar
Private Sub Form1_Load()
RC = New SpSharedRecoContext
Label1.Text = "Form Loaded"
myGrammar = RC.CreateGrammar
myGrammar.CmdLoadFromFile("e:\SolApp\sol.xml", SLODynamic)
myGrammar.CmdSetRuleIdState(0, SGDSActive)
Label1.Text = "Grammar Loaded"
End Sub
My big problem is how this function work.....:(
Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Text = "(no recognition)"
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal RecognitionType As
SpeechLib.SpeechRecognitionType, ByVal Result As
SpeechLib.ISpeechRecoResult)
Label1.Text = Result.PhraseInfo.GetText
End Sub
thank you
Re: code doesn't run (on an XP machine)?
You just copied and pasted the code that your friend sent! You are not sure about the code! And you are expecting us to understand it magically so that you could help your so called friend?!
Buddy life is not that easy ;)
Re: code doesn't run (on an XP machine)?
:thumb: hi...
its not for girl hehe.. but really its very big helpto me....
noo i didnt run it on XP.. he sent to me this error and i passed it to forums.. but actually i dont know this code is vb or vb.net .....just i paste this in vb.net and checked.. only this codes work...
Option Explicit Off
Imports SpeechLib
Public Class Form1
Public WithEvents RC As SpSharedRecoContext
Public myGrammar, b As ISpeechRecoGrammar
Private Sub Form1_Load()
RC = New SpSharedRecoContext
Label1.Text = "Form Loaded"
myGrammar = RC.CreateGrammar
myGrammar.CmdLoadFromFile("e:\SolApp\sol.xml", SLODynamic)
myGrammar.CmdSetRuleIdState(0, SGDSActive)
Label1.Text = "Grammar Loaded"
End Sub
My big problem is how this function work.....:(
Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Text = "(no recognition)"
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal RecognitionType As
SpeechLib.SpeechRecognitionType, ByVal Result As
SpeechLib.ISpeechRecoResult)
Label1.Text = Result.PhraseInfo.GetText
End Sub
thank you
Re: code doesn't run (on an XP machine)?
Thankyou verymuch for your advice and thanks for help ... Im doing c# asp so i dont have any experienc e abt this.. normally our c# site forums we are checkig and sending answers .. but you just ask.. may be all of u to havent much idea abt this ....:rolleyes:
Re: code doesn't run (on an XP machine)?
Quote:
Originally Posted by msbsam
Thankyou verymuch for your advice and thanks for help ... Im doing c# asp so i dont have any experienc e abt this.. normally our c# site forums we are checkig and sending answers .. but you just ask.. may be all of u to havent much idea abt this ....:rolleyes:
Look who's talking!!
You say you know C# and not VB. You are talking about just two different languages. The concepts are the same. If you know OOP concepts, language is merely a barrier. Anyway, dont keep this attitude if you are expecting help from others.
Re: code doesn't run (on an XP machine)?
You say you know C# and not VB. You are talking about just two different languages. The concepts are the same. If you know OOP concepts, language is merely a barrier. Anyway, dont keep this attitude if you are expecting help from others.
no sry.. just i said i dont know vb oe vb.net .. asked help from this site. but i said what i know abt this problem...
Re: code doesn't run (on an XP machine)?
Lets all just try to get along :D
Quote:
Originally Posted by msbsam
Code:
Option Explicit Off
Imports SpeechLib
Public Class Form1
Public WithEvents RC As SpSharedRecoContext
Public myGrammar, b As ISpeechRecoGrammar
Private Sub Form1_Load()
RC = New SpSharedRecoContext
Label1.Text = "Form Loaded"
myGrammar = RC.CreateGrammar
myGrammar.CmdLoadFromFile("e:\SolApp\sol.xml", SLODynamic)
myGrammar.CmdSetRuleIdState(0, SGDSActive)
Label1.Text = "Grammar Loaded"
End Sub
The line "Form1_Load()" procedure doesnt have the correct procedure signature.
It should look like...
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Without the form load event having a proper event handler it will never fire so your speech object may not be initialized to run.
Re: code doesn't run (on an XP machine)?
Thank you RobDog888 replied....
But still it not comming any sounds.... This is my code.. Now it has form load event . I want to know how to work this two methods..
Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Text = "(no recognition)"
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal
StreamPosition As Object, ByVal RecognitionType As
SpeechLib.SpeechRecognitionType, ByVal Result As
SpeechLib.ISpeechRecoResult)
Label1.Text = Result.PhraseInfo.GetText
End Sub
Thank you ....
Please reply
Re: code doesn't run (on an XP machine)?
Have you checked the documentation in the SDK yet?
Perhaps this link may be easier
http://www.autoitscript.com/forum/in...ch+recognition
This should help insure your mic is adjusted/working.
http://gotspeech.net/forums/thread/6908.aspx
Re: code doesn't run (on an XP machine)?
I do not condone the act of cheating on tests purely for the fact that I was never allowed to do so.