如何在C#Winform中运行另一个程序(C ++)? [英] How to operate another program(C++) in a C# winform?

查看:367
本文介绍了如何在C#Winform中运行另一个程序(C ++)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ac#winform项目,希望它可以遍历所有控件并读取其他c ++程序的值(也可以对其进行操作,例如单击按钮,输入内容等),任何人都可以提供线索,还是一个例子,好吗?非常感谢.

I have a c# winform project which I wish that it can traverse all the controls and read their values of another c++ program (also can operate it, like clicking a button, inputing something etc.), can anybody give a clue, or an example, please? Thanks a lot.

推荐答案

首先,您需要获取其他正在运行的程序的句柄.
您可以使用EnumWindows枚举所有正在运行的应用程序.

拥有其他应用程序的句柄后,可以使用EnumChildWindows来获取每个控件的句柄.

要获取每个控件的值,必须使用控件句柄发送WM_GETTEXT消息.
First of all you need to get the handle of the other running program.
You can use EnumWindows to enumerate all running applications.

Once you have the handle to the other application you can use EnumChildWindows to get the handle to each of the controls.

To get the value of each control, you must send the WM_GETTEXT message using the control handle.


阅读下面的文章..,如何实现

http://www.codeproject.com/KB/cs/SendKeys.aspx [ ^ ]
Go through the Below article.., how that can be implement

http://www.codeproject.com/KB/cs/SendKeys.aspx[^]


这篇关于如何在C#Winform中运行另一个程序(C ++)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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