Gio*_*now 7 c# on-screen-keyboard
I want to start the new On-Screen-Keyboard (OSK) using code. You can find this one in the taskbar:

(if not there you find it by right clicking the taskbar).
I have already tried the regular:
System.Diagnostics.Process.Start("osk.exe");
Run Code Online (Sandbox Code Playgroud)
But I want to start the other one (not in window mode). Here you see which OSK I want and which one not:

How can I start that version? And how can I start it in a certain setting (if possible)?
通过在命令行中启动进程
我相信您想在 Windows 10 中启动以下过程,如下所示:
"C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe"
Run Code Online (Sandbox Code Playgroud)
正如@bernard-vander-beken所建议的,最好使用
Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles)
Run Code Online (Sandbox Code Playgroud)
生成"C:\Program Files\Common Files\"适合不同安装位置的路径部分。
通过 API
前面的命令行似乎以不一致的方式工作,特别是如果进程tabtip.exe已经在运行,它就不会工作两次。
我在这个线程上找到了 @torvin 的这个片段,在开始使用命令行解决方案后,您可以使用它以编程方式显示屏幕键盘,否则它会失败并出现异常。tabtip.exeCOM
class Program
{
static void Main(string[] args)
{
var uiHostNoLaunch = new UIHostNoLaunch();
var tipInvocation = (ITipInvocation)uiHostNoLaunch;
tipInvocation.Toggle(GetDesktopWindow());
Marshal.ReleaseComObject(uiHostNoLaunch);
}
[ComImport, Guid("4ce576fa-83dc-4F88-951c-9d0782b4e376")]
class UIHostNoLaunch
{
}
[ComImport, Guid("37c994e7-432b-4834-a2f7-dce1f13b834b")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface ITipInvocation
{
void Toggle(IntPtr hwnd);
}
[DllImport("user32.dll", SetLastError = false)]
static extern IntPtr GetDesktopWindow();
}
Run Code Online (Sandbox Code Playgroud)