Unable to launch onscreen keyboard (osk.exe) from a 32-bit process on Win7 x64

前端 未结 6 1292
抹茶落季
抹茶落季 2020-12-03 14:08

90% of the time I am unable to launch osk.exe from a 32bit process on Win7 x64. Originally the code was just using:

Process.Launch(         


        
6条回答
  •  失恋的感觉
    2020-12-03 14:42

    This is my code

                var path64 = Path.Combine(Directory.GetDirectories(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "winsxs"), "amd64_microsoft-windows-osk_*")[0], "osk.exe");
                var path32 = @"C:\windows\system32\osk.exe";
                var path = (Environment.Is64BitOperatingSystem) ? path64 : path32;
                if(File.Exists(path))
                {
                    Process.Start(path);
                }
    

提交回复
热议问题