简体   繁体   中英

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:

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

Is there a way in C# to dock this keyboard to the bottom of the screen when opened?
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 . However, running osk.exe /dockbottom just places the keyboard at the bottom of your screen, it is not exactly the same as docking. I don't know how far back this parameter works but I confirmed it works in Windows 8 and 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.

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. 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. You can control this keyboard with IFrameworkInputPane .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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