使用 PostMessage 模拟鼠标事件而不获得焦点 (WINAPI)
我使用 PostMessage 模拟鼠标事件并在记事本应用程序上进行测试。 我不想通过发送鼠标事件来获得记事本应用程序的焦点。
仅当我在 PostMessage 参数中使用记事本的 ChildWindow(即可以写入的空白区域)时才会收到事件,这意味着我无法单击应用程序的菜单(文件、编辑...)。您知道如何在不设定焦点的情况下做到这一点吗?
I emulated the mouse events using PostMessage and tested on the notepad application.
I don't want to gain focus of the notepad application by sending mouse events.
The events are received only if I use the ChildWindow of the notepad (ie the white space where you can write) in PostMessage parameters, that means I can't click on the menu of the app (File, Edit ..). Do you have any idea on how to do that without setting the focus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要使用窗口菜单的菜单项,请找出菜单命令 ID,然后通过 WM_COMMAND 消息将它们发送到主窗口。使用 Spy++ 帮助处理菜单命令 ID。
If you want to use the menu items of a window menu, figure out the menu command ID's and then send them to the main window via the WM_COMMAND message. Use Spy++ to help with the menu command ID's.