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

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

问题描述

我想从我的C#应用​​程序点击一个按钮,在其他应用程序,
我没有源$ 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来获取窗口句柄,然后遍历窗口元素和使用的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.

下面是一个$ C $的CProject项目,不正是你想要的。

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

code项目

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

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