【发布时间】:2018-06-26 08:01:58
【问题描述】:
我想打开一个应用程序,然后单击该应用程序中的一个按钮,例如,我正在打开 Microsoft Paint 并尝试单击具有存储桶图像的“填充颜色”按钮。
我只放了流程启动代码,不知道从哪里开始
public partial class Form1 : Form
{
public Process P;
public IntPtr WindowHandle;
public Image TargetButton;
public Form1()
{
InitializeComponent();
Init();
}
private void Init()
{
TargetButton = Bitmap.FromFile("Bucket.JPG");
P = Process.Start("C:\\Windows\\System32\\mspaint.exe");
WindowHandle = P.MainWindowHandle;
// now to find that button and click it, I have the button stored as image in TargetButton variable above
}
}
【问题讨论】: