Results 1 to 16 of 16

Thread: code doesn't run (on an XP machine)?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    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

  2. #2
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    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?
    Microsoft Techie

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: code doesn't run (on an XP machine)?

    Any error messages?

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    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

  5. #5
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    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
    Microsoft Techie

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    Re: code doesn't run (on an XP machine)?

    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

  8. #8
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    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
    Microsoft Techie

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    Re: code doesn't run (on an XP machine)?

    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

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    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 ....

  11. #11
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    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 ....
    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.
    Microsoft Techie

  12. #12

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    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...

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: code doesn't run (on an XP machine)?

    Lets all just try to get along



    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Posts
    8

    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

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width