简体   繁体   English

C#是否可以停靠Windows 10的屏幕键盘?

[英]Is there a way for c# to dock onscreen keyboard of windows 10?

You can open the Windows 10 on-screen keyboard from C# code using: 您可以使用以下命令从C#代码打开Windows 10屏幕键盘:

System.Diagnostics.Process.Start("osk.exe");

Is there a way in C# to dock this keyboard to the bottom of the screen when opened? 在C#中,有没有一种方法可以在打开该键盘时将其固定在屏幕底部?
I need to create the same effect that 'dock' button does on the onscreen keyboard itself. 我需要创建与“停靠”按钮在屏幕键盘本身上相同的效果。

osk.exe supports a undocumented command line parameter /dockbottom . osk.exe支持未记录的命令行参数/dockbottom However, running osk.exe /dockbottom just places the keyboard at the bottom of your screen, it is not exactly the same as docking. 但是,运行osk.exe /dockbottom只是将键盘放在屏幕的底部,它与停放并不完全相同。 I don't know how far back this parameter works but I confirmed it works in Windows 8 and 10. 我不知道此参数的工作时间有多远,但我确认它在Windows 8和10中可以工作。

I don't think there is a way to actually dock ( app bar docking) programmatically. 我认为没有办法以编程方式实际停靠( 应用程序栏停靠)。 Faking a click on the UI button might work but you would have to use UI Automation because it is not a real button, the whole window is a DirectUIHWND window. 假冒单击UI按钮可能会起作用,但是您必须使用UI Automation,因为它不是真正的按钮,整个窗口都是DirectUIHWND窗口。

As a hack you can set a REG_DWORD called Dock to 1 under HKEY_CURRENT_USER\\Software\\Microsoft\\Osk and HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility\\ATConfig\\osk (this is a volatile key so you must open it as such) while osk.exe is not running. 作为一种黑客,您可以在HKEY_CURRENT_USER\\Software\\Microsoft\\OskHKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility\\ATConfig\\osk下将名为Dock的REG_DWORD设置为1 (这是一个易失性密钥,因此您必须这样打开),而osk.exe没有运行。 When you start it again it will read the dock setting and start docked. 当您再次启动它时,它将读取停靠设置并开始停靠。

Note: This docking mode is not available if the screen resolution is set too low. 注意:如果屏幕分辨率设置得太低,则无法使用此停靠模式。

Windows 8 and later also have a different on-screen-keyboard called the touch keyboard. Windows 8和更高版本还具有一个不同的屏幕键盘,称为触摸键盘。 You can control this keyboard with IFrameworkInputPane . 您可以使用IFrameworkInputPane控制此键盘。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM