模拟使用sendmessage单击菜单 [英] simulate click on menu using sendmessage

查看:448
本文介绍了模拟使用sendmessage单击菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有.......

我正在开发一个项目,希望通过严格使用消息来访问应用程序.所以我想使用SendMessage模拟菜单上的单击.
有谁知道有关如何单击菜单以查看菜单项列表的完整代码.

我的代码在工作区工作,但我无法单击非工作区.

在此先感谢您.

all................

I am developing a project where i want to access an application through strictly using messages. So i want to simulate click on menu using SendMessage.
Does anyone know complete code about how to click on menu to see list of menu items.

My code works in client area but i am unable to click on non-client area.

Thanks in advance.

推荐答案

不要这样做!这是一种非常糟糕的编程风格,它将在以后给您带来困难.如果您已经遇到了需要的情况,请更改设计.您现在拥有的东西是错误的,将导致您无处可去.

而是有一个单独的函数,该函数从菜单项click的处理程序和其他地方调用.

如果由于某些原因您仍然需要模拟单击或键盘输入,请使用Windows API SendInput.它是低级且高度通用的,如果您使用硬件进行输入,则可以正常工作.请参阅 http://msdn.microsoft.com/en-us/library/ms646310(v = vs.85).aspx [
Don''t do it! This is a really bad style of programming which will give you hard time a bit later. If you already came to the situation you need it, change your design; what you have now is wrong and will lead you nowhere.

Instead, have a separate function which is called from the handler of a menu item click and elsewhere.

If by some reason you still need to simulate a click or a keyboard input, use Windows API SendInput. It is low-level and highly universal, works exactly if you did the input using hardware. See http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

—SA


这篇关于模拟使用sendmessage单击菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆