1
votes

Good Day,

I have searched the Internet tirelessly trying to find an example of how to start Windows Speech Training from with in my VB.Net Speech Recognition Application.

I have found a couple examples, which I can not get working to save my life.

One such example is on the Visual Studios Fourms:

HERE

this particular example users the "Process.Start" call to try and start the Speech Training Session. However this does not work for me. Here is the exmaple from that thread:

    Process.Start("rundll32.exe", "C:\Windows\system32\speech\speechux\SpeechUX.dll, RunWizard UserTraining")

What happens is I get and error that says:

       There was a problem starting

      C:\Windows\system32\speech\speechux\SpeechUX.dll

      The specified module could not be found

So I tried creating a shortcut (.lnk) file and thought I could access the DLL this way. My short cut kind of does the same thing. In the short cut I call the "rundll32.exe" with parameters:

          C:\Windows\System32\rundll32.exe "C:\Windows\system32\speech\speechux\SpeechUX.dll" RunWizard UserTraining 

Then in my VB.Net application I use the "Process.Start" and try to run the shortcut.

This also gives me the same error. However the shortcut itself will start the SPeech Training session. Weird?!?

So, I then took it one step further, to see if it has something to do with my VB.Net Application and the "Process.Start" Call.

I created a VBScript, and using "Wscript.Shell" I point to the Shortcut.

Running the VBScript calls the Shortcut and low and behold the Speech Training starts!

Great! But...

when I try to run the VBscript from my VB.net Application, I get that error again.

What the heck is going on here?

2

2 Answers

1
votes

Your problem likely is that your program is compiled as 32-bit and your OS is 64-bit, and thus, when you try to access "C:\Windows\System32\Speech\SpeechUX\SpeechUX.dll" from your program, you're really accessing "C:\Windows\SysWOW64\Speech\SpeechUX\SpeechUX.dll" which, as rundll32.exe is reporting doesn't exist.

Compile your program as 64-bit instead or try the pseudo directory %SystemRoot%\sysnative.

Also, instead of rundll32.exe, you may want to just run SpeechUXWiz.exe with an argument.

Eg.

private Process StartSpeechMicrophoneTraining()
{
    Process process = new Process();
    process.StartInfo.FileName = System.IO.Path.Combine(Environment.SystemDirectory, "speech\\speechux\\SpeechUXWiz.exe");
    process.StartInfo.Arguments = "MicTraining";
    process.Start();
    return process;
}

private Process StartSpeechUserTraining()
{
    Process process = new Process();
    process.StartInfo.FileName = System.IO.Path.Combine(Environment.SystemDirectory, "speech\\speechux\\SpeechUXWiz.exe");
    process.StartInfo.Arguments = "UserTraining";
    process.Start();
    return process;
}

Hope that helps.

Read more about Windows 32-bit on Windows 64-bit at http://en.wikipedia.org/wiki/WoW64 or your problem specifically at http://en.wikipedia.org/wiki/WoW64#Registry_and_file_system

1
votes

If you are using a 64bit OS and want to access system32 folder you must use the directory alias name, which is "sysnative".

"C:\windows\sysnative" will allow you access to system32 folder and all it's contents.

Honestly, who decided this at Microsoft is just silly!!