键盘事件生成问题
我必须从我的控制台应用程序发送带有字符代码 nChar
和事件代码 nFlags
的键盘事件: SendKeyboardEvent(UINT nChar, UINT nFlags)
对于 MFC 对话框,此函数将映射到某些事件处理程序,因此我根本不必担心 nFlags
。有人可以指出我如何获得控制台应用程序的该值吗?
I have to send a keyboard event from my console app with character code nChar
and event code nFlags
:SendKeyboardEvent(UINT nChar, UINT nFlags)
For MFC dialog this function would be mapped to some event handler so I wouldn't have to worry about nFlags
at all. Can someone point me to how I could obtain that value for the console app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试在另一个应用程序中模拟键盘,您应该使用的函数是 SendInput() 或至少是 keybd_event()。请记住,您必须首先设置焦点窗口,否则您的输入将不会到达您预期的位置。
SendInput() : http://msdn.microsoft.com/en-us/library/ms646310
If you're trying to simulate the keyboard in another application, the function you should be using is SendInput() or at least keybd_event(). Keep in mind you have to set the focus window first or else your input won't go where you expected.
SendInput() : http://msdn.microsoft.com/en-us/library/ms646310