无法以编程方式找到按钮

时间:2014-06-10 17:30:38

标签: c#

我编写了一个以编程方式按下"安装" WebPlatformInstaller上的按钮,但它没有找到此按钮。你能帮我解决这个问题吗?

Windows:00030590 文字:安装 类:WindowsForms10.BUTTON.app.0.378734a 风格:5601000B

这是我的代码:

Process[] processes = Process.GetProcessesByName("WebPlatformInstaller");

foreach (Process p in processes)// debug shows that there is 1 process
{
   IntPtr ButtonHandle = FindWindowEx(p.MainWindowHandle, IntPtr.Zero, "Install", null);
   SendMessage(ButtonHandle, BM_CLICK, IntPtr.Zero, IntPtr.Zero);

}

0 个答案:

没有答案