c#和外部.exe集成 [英] c# and external .exe integration

查看:90
本文介绍了c#和外部.exe集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个C#程序,它将启动一个.exe(这是一个简单的工作,我知道该怎么做。)但现在我想为它添加更多功能。我想将用户输入传递给我的程序,并希望将它们作为输入传递给运行.exe。我还要单击exe窗口上的特定按钮。重要的是,我想以编程方式进行,而不是用户知道我们实际上在后台运行该exe文件。

I want to write a C# program which will launch an .exe (this is an easy job, I know how to do it.) but now I want to add some more functionality to it. I want to take user inputs to my program and want to pass them to running .exe as a input.Also I want to click on a particular button available on the exe window. Important thing is, I want to do it programatically without user knowledge that we are actually running that exe in background.

word = textBox1.Text;
           Process myprocess = new Process();
           myprocess.StartInfo.FileName = @"C:\Users\Public\Desktop\Cambridge Advanced Learner's Dictionary - 3rd Edition.lnk";

           myprocess.Start();
           myprocess.WaitForInputIdle();
           Thread.Sleep(3000);
           SendKeys.Send(word);



接下来要做什么?



已添加代码块[/编辑]


what to do next?

Code block added[/Edit]

推荐答案

您好,



看看这里:

http://stackoverflow.com/questions/ 4899573 /从另一个应用程序点击一个按钮 - 来自我的应用程序 [ ^ ]

http://stackoverflow.com/questions/3009557/click-a-button-in-another-application [ ^ ]

http://stackoverflow.com/questions/6408547/interacting-with-other-applications-like-clicking-a-button [ ^ ]

http:// social .msdn.microsoft.com / forums / zh-CN / winforms / thread / 345d85e8-cc5f-4508-b3f2-74ee43521169 / [ ^ ]

再次使用C#中的Windows API! [ ^ ]
Hi,

Have a look here:
http://stackoverflow.com/questions/4899573/click-on-a-button-in-another-application-from-my-c-sharp-application[^]
http://stackoverflow.com/questions/3009557/click-a-button-in-another-application[^]
http://stackoverflow.com/questions/6408547/interacting-with-other-applications-like-clicking-a-button[^]
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/345d85e8-cc5f-4508-b3f2-74ee43521169/[^]
Using Windows APIs from C#, again![^]


这篇关于c#和外部.exe集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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