| | |
Speech recognizer program closes very slow
![]() |
•
•
Join Date: Jan 2008
Posts: 87
Reputation:
Solved Threads: 1
I put together a simple speech recognizer. It works fine, but when I click the X to close it, it takes forever to unload... can I do anything about it?
thanks =)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim WithEvents RecoContext As SpInProcRecoContext 'RC Dim Grammar As ISpeechRecoGrammar Dim Recognizer As SpInprocRecognizer Private Sub Form_Unload(Cancel As Integer) Set RecoContext = Nothing 'these did not work =( Set Grammar = Nothing ' =( Set Recognizer = Nothing ' =( End Sub Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechRecognitionType, ByVal Result As ISpeechRecoResult) Dim strText As String strText = Result.PhraseInfo.GetText(0, -1, True) Select Case strText Case "calculator" MsgBox "calc.exe" End Select End Sub Private Sub Form_Load() Dim Category As SpObjectTokenCategory Dim Token As SpObjectToken Set RecoContext = New SpInProcRecoContext Set Recognizer = RecoContext.Recognizer Set Grammar = RecoContext.CreateGrammar(1) Grammar.CmdLoadFromFile App.Path & "\grammar.xml", SLOStatic Grammar.DictationSetState SGDSInactive Grammar.CmdSetRuleIdState 1, SGDSActive Set Category = New SpObjectTokenCategory Category.SetId SpeechCategoryAudioIn Set Token = New SpObjectToken Token.SetId Category.Default() Set Recognizer.AudioInput = Token End Sub
thanks =)
•
•
Join Date: Mar 2009
Posts: 1,217
Reputation:
Solved Threads: 220
Don't know if it will help... but do your object have a close method or other house keeping call you can make before you set them to nothing? Or if you are worried about your form staying up, just add a me.hide before you do your current code.
Good Luck
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
•
•
Join Date: Jan 2008
Posts: 87
Reputation:
Solved Threads: 1
strange....it only seems to happen sometimes...it will hang for like 3 or 4 seconds on closing..
this seems to help, if I stick it in Form_Unload, so thanks =) I think it may be that the recognition has a timeout or something...I tried snapping my fingers and making some noise before closing it and it froze for a few seconds...LoL forgot the doevents? =/
'SpInProcRecoContext
RecoContext.Pause
this seems to help, if I stick it in Form_Unload, so thanks =) I think it may be that the recognition has a timeout or something...I tried snapping my fingers and making some noise before closing it and it froze for a few seconds...LoL forgot the doevents? =/
'SpInProcRecoContext
RecoContext.Pause
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: speed up fill listview
- Next Thread: delete problem
Views: 520 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 7 429 2007 access activex ado append array basic beep beginner blackjack bmp c++ calculator cd channel9 click component connectionproblemusingvb6usingoledb data database datareport date delete dissertationtopic error excel file filename form game grid group hardware header icon image interaction key keypress label list listbox liveperson looping macro match measure messagebox metadata microsoft movingranges nice number object open oracle os outlook password pdf picture print printer problem program prompt query random reading record refresh remotesqlserverdatabase report reports save search size sort sound spectateswamp sql struct subroutine sum table tags timer variable variables vb vb6 vb6.0 vba visual visualbasic web windows






