WinAPI的C ++例如模拟按钮点击与窗口句柄 [英] WinAPI C++ simulate button clicked with window handle

查看:1068
本文介绍了WinAPI的C ++例如模拟按钮点击与窗口句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图完成模拟按钮对话框上点击。

I have been trying to accomplish simulating a button clicked on a dialog box.

我有手柄的窗口。这是一个中止/重试/忽略样的窗口。我不能强迫谷歌从任何更多有用的信息。

I have the handle to the window. This is an Abort/Retry/Ignore kind of window. I can't force any more useful information from google.

我不想去与simulacting一个的x点击和Y坐标,因为它不符合我的需求。

I don't want to go with simulacting a click having X and Y coordinates as it doesn't suit my needs.

推荐答案

查找句柄要单击(通过使用 FindWindowEx )的按钮,只要发送点击消息:

Find the handle to the button that you want to click (by using FindWindowEx), and just send click message:

SendMessage(hButton, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(0, 0));
SendMessage(hButton, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(0, 0));

这篇关于WinAPI的C ++例如模拟按钮点击与窗口句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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