| | |
Speech recognizer program closes very slow
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 84
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: 910
Reputation:
Solved Threads: 167
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: 84
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: 478 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





