- VS 2010
- 开发在 64 位操作系统(Windows 7、Windows 8 - 桌面应用)上运行的 32 位应用
- C#
- .NET 4.0
- WinForms
我发现有很多关于从应用程序启动 Windows 屏幕键盘 (osk.exe) 的线程,但我遇到了一些问题.似乎是因为我在 64 位操作系统上运行 32 位应用程序.我在这里尝试了 WooCaSh 发布的代码:WinForms 中屏幕上的键盘
I have found many threads on launching the Windows on-screen keyboard (osk.exe) from an application, but I am running into some problems. It appears to be because I am running a 32-bit app on a 64-bit OS. I've tried the code posted by WooCaSh here: Keyboard on the screen in WinForms
但是这三种不同的路径都不适合我.对于 sysnative 路径,Process.Start 失败并显示 找不到指定的路径." 对于 system32 和osk.exe 路径,我收到无法启动屏幕键盘" 错误对话框.
But none of the three different paths work for me. For the sysnative path, Process.Start fails with "Cannot find the path specified." For the system32 and osk.exe paths, I get the "Could not start the on-screen keyboard" error dialog.
我在这里找到了一个可能的解决方法,它比我想要的要复杂一些(由 eryang 发布):social.msdn.microsoft/Forums/en-US/netfx64bit/thread/10ebc62f-4072d-9fd1-ea3784a0966f/
I found a possible workaround here, which is a little more complicated than what I was looking for (post by eryang): social.msdn.microsoft/Forums/en-US/netfx64bit/thread/10ebc62f-e6d7-4072-9fd1-ea3784a0966f/
我现在推出触摸键盘",而不是屏幕键盘"(无论如何,这是我在 Windows 8 上想要的键盘),具有:
I am now launching the "Touch Keyboard" as opposed to the "On-Screen Keyboard" (which is the keyboard I wanted on Windows 8 anyway) with:
string progFiles = @"C:Program FilesCommon FilesMicrosoft Sharedink"; string keyboardPath = Path.Combine(progFiles, "TabTip.exe"); this.keyboardProc = Process.Start(keyboardPath);这适用于我的 Win7 和 Win8,无论我在 64 位操作系统上的 32 位应用程序如何.但是,我仍然遇到在完成后以编程方式关闭键盘的问题.进程,this.keyboardProc,似乎没有得到句柄,并立即拥有属性HasExited = true.这意味着我试图关闭或杀死它失败了.
This works on my Win7 and Win8, regardless of my 32-bit app on 64-bit OS. However, I still have the problem of programmatically closing the keyboard when I'm done. The process, this.keyboardProc, does not seem to get the handle, and immediately has property HasExited = true. This means my attempts to close or kill it fail.
根据这个线程,如果用户手动打开键盘(或者我以编程方式启动它),当文本字段失去焦点时,键盘不会自动关闭/隐藏:Windows 8 - 如何关闭触摸键盘? 我尝试了将焦点设置为隐藏按钮的解决方法,但自从我启动键盘自己,它不会自动关闭.
According to this thread, if the user manually opens the keyboard (or I programmatically launch it), the keyboard will not automatically close/hide when the text field loses focus: Windows 8 - How to Dismiss Touch Keyboard? I tried the workaround of setting the focus to a hidden button, but since I launched the keyboard myself, it doesn't close automatically.
更多推荐
如何在 C# WinForms 中使用 Windows 屏幕键盘
发布评论