C# 调用键盘
首先我们说的键盘指的是:tabtip和osk。但这两个所在的位置不同,样貌也不一样
C:\Windows\System32\osk.exe
C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe
调用之前,最好先杀一下之前的键盘进程
var processes = Process.GetProcessesByName(Path.GetFileNameWithoutExtension("TabTip")); foreach (var p in processes) { p.Kill(); }
最后启动键盘进程
var commonFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles); //程序集目标平台为X86时,获取到的是x86的Program Files,但TabTip.exe始终在Program Files目录下 if (commonFilesPath.Contains("Program Files (x86)")) { commonFilesPath = commonFilesPath.Replace("Program Files (x86)", "Program Files"); } var tabTipPath = Path.Combine(commonFilesPath, @"microsoft shared\ink\TabTip.exe"); if (File.Exists(tabTipPath)) { ProcessStartInfo psi = new ProcessStartInfo { FileName = tabTipPath, UseShellExecute = true, CreateNoWindow = true }; Process.Start(psi); }