views:

76

answers:

2

Hello,

I want to know if it's possible to control "Microsoft Speech Recognition" using c#.

alt text

Is it possible, for instance, to simulate the click on "On: Listen to everything I say" programmatically using c# or python?

A: 

Here's Microsoft's Speech API documentation, and an example in Python.

JRobert
m8, please read my question! I don't want to do the Speech Recognition part. I want to simulate the click on the button ON programmatically!
aF
You're welcome, m8.
JRobert
A: 

JRobert had the right idea.

If you were using C++, then you would call ISpRecognizer::SetRecoState(SPRST_ACTIVE), and then, if you're running on Windows 7, QI the ISpRecognizer for ISpRecognizer3 and call ISpRecognizer3::SetActiveCategory(NULL) to force the recognizer into the ON state.

But, since you're using C#, you should use System.Speech.Recognition.SpeechRecognizer and set the State property to Listening. (Note that this will not, as far as I know, switch from Sleep to On.)

Eric Brown
thanks m8I also have some c++ code :) so I can do what you told ^^
aF
this worked quite well :)do you know how to minimize it?
aF
There's no direct API, but the UI has an HWND (whose class you can discover with Spy++ or Inspect), and you can minimize it by posting a WM_SYSCOMMAND message with WParam == SC_MINIMIZE.
Eric Brown