创建一个 WPF 触摸屏键盘应用程序,将按键发送到另一个窗口
我的触摸屏键盘是高度可定制的界面,除了发送按键之外,拥有我需要的所有组件,任何人都会看到这个问题。最初,当我创建它时,我打算使用 Forms.SendKeys.Send() 但它是一个 WPF 应用程序......不行。对于初学者来说,VB.Net以其无限的智慧决定它不会处理默认表单消息。去算算吧。
或者,这可能是我真正的问题,我无法让 WPF 应用程序停止获得焦点。我希望它像 Windows 触摸键盘一样工作,但是透明 WPF 中发生的每个操作都会使该应用程序成为活动应用程序。我希望事件仍然发生,但我需要活动窗口是您想要输入内容的窗口,例如记事本。
关于我应该做什么,使我的 WPF 不可聚焦并将键盘按钮发送到聚焦(或其他)窗口的任何建议?
PS,我在 Vb.Net 的 Visual Studio 2010 中使用 WPF(我可以使用 C# 代码!)
My touch screen keyboard is highly customizable interface and has every component I need except for sending keys, anyone see a problem with this. Originally when I was creating it I was going to use the Forms.SendKeys.Send() but it's a WPF application... no go. For starters VB.Net in its infinite wisdom decided it would not handle default form messages. Go figure.
Or perhaps, this is my real problem, I can't get the WPF application to stop getting focus. I want it to act like the windows touch keyboard, but Every action that occurs in the transparent WPF makes that application the active one. I want events to still occur but I need the active window to be the window you wish to type into, like notepad.
Any Suggestions on what I should do, to make my WPF not focusable and to send keyboard buttons to the focused (or other) window?
PS, I'm using WPF in Visual Studio 2010 in Vb.Net (I can use C# Code to!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你会在这里找到答案有
很多复杂的方法可以实现这一点,但我提出的解决方案是上面的链接很简单,只有一个怪癖,老实说可以解决。拖动输入窗口时,它不会提供反馈,直到移动完成,但您可以通过处理一些非客户端消息来解决此问题,如果您需要,我可以花一些时间查看解决方法,但首先确认此解决方案是正确的为你。
更新:如何将上述方法应用于 WPF 表单的示例。
I think you will find the answer here usefull
There are a number of compilcated ways to achieve this, but the solution I posed that the above link is easy and only has one quirk, that to be honest can be worked around. When dragging the input window it does not provide feedback until the move is completed, but you can work around this by handling some non-client messages, I can spend sometime look at the work around if you need, but first confirm this solution is right for you.
Update: A sample of how a the approach above can be applied to a WPF form.