Today something supposedly very simple. How to run On Screen Keyboard from C#? Easy enough you say and type the following code:
1 |
Process.Start(@"osk.exe"); |
And then you compile it as Any CPU, run on Windows 10 x64 and you get the following error:
What happens? It looks like 32 bit osk.exe
is broken in Windows 10 x64 (tested with Windows 10 1703 Enterprise x64). To solve this just run 64 bit version of keyboard:
1 |
Process.Start(@"c:\Windows\Sysnative\cmd.exe", "/c osk.exe"); |
Of course you should use some environment variables, something like:
1 |
Process.Start(Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.System)).FullName, "Sysnative", "cmd.exe"), "/c osk.exe"); |