从我的 C# 应用程序单击另一个应用程序中的按钮? [英] click on a button in another application from my C# application?

查看:50
本文介绍了从我的 C# 应用程序单击另一个应用程序中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的 C# 应用程序中单击另一个应用程序中的按钮,
我没有包含按钮的应用程序的源代码

I want to click on a button in another application from my C# application ,
and I don't have the source code for the application that contains the button

让我们举个例子......我可以通过以编程方式单击其按钮来使用我的应用程序中的 Windows 计算器
我正在使用 c# 和 .NET
我想我必须使用 windows api 来做到这一点
有人知道吗????

let us say as an example ...can I use windows calculator from my application by clicking its buttons Programmatically
I am using c# and .NET
I think I must use windows api to do this
does anybody have any idea????

推荐答案

是的,并不太复杂.您可以使用 FindWindowEx 获取窗口句柄,然后遍历 windows 元素并使用 sendmessage 或 postmessage 发送 WM_Click 消息.

Yes, it's not too complicated. You can use FindWindowEx to get the window handle, then iterate through the windows elements and use sendmessage or postmessage to send the WM_Click message.

这是一个完全符合您要求的代码项目.

Here's a codeproject project that does exactly what you want.

代码项目

这篇关于从我的 C# 应用程序单击另一个应用程序中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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