Peoblem releasing the event handler?
-
Hello everyone, I am trying to add the Speech Recognission into my Windows Application. I have added a button which activates the Speech Recognission once it is clicked by assigning two Event Handeler shown bellow: // Get an insance of RecoContext "Using Shared RecoContext". objRecoContext = new SpeechLib.SpSharedRecoContext(); // Assign an eventhandler for the Hypothesis Event. objRecoContext.Hypothesis += new _ISpeechRecoContextEvents_HypothesisEventHandler(Hypo_Event); // Assign an eventhandler for the Recognition Event. objRecoContext.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(Reco_Event); Now I would like to add a button to Disable the Speech Recognission. Can someone be kind enough to tell me how I can do this? I tried the following code in order to release the event handler but it is not doing it. //code to realease the event handler objRecoContext = null; Thank you so much for your help and have a great day. Khoramdin
-
Hello everyone, I am trying to add the Speech Recognission into my Windows Application. I have added a button which activates the Speech Recognission once it is clicked by assigning two Event Handeler shown bellow: // Get an insance of RecoContext "Using Shared RecoContext". objRecoContext = new SpeechLib.SpSharedRecoContext(); // Assign an eventhandler for the Hypothesis Event. objRecoContext.Hypothesis += new _ISpeechRecoContextEvents_HypothesisEventHandler(Hypo_Event); // Assign an eventhandler for the Recognition Event. objRecoContext.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(Reco_Event); Now I would like to add a button to Disable the Speech Recognission. Can someone be kind enough to tell me how I can do this? I tried the following code in order to release the event handler but it is not doing it. //code to realease the event handler objRecoContext = null; Thank you so much for your help and have a great day. Khoramdin
I thought you could use -= to remove an event handler ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I thought you could use -= to remove an event handler ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hello Christian, You were correct. I tried it with " -= " and it worked. I must have been on a different planet, mate. Thank you so much for your help. Khoramdin