从流程中查找窗口

时间:2014-07-21 09:27:24

标签: c# process window

我有GetProcessesByName("" + Path,"X.X.X.X")的进程,我需要知道从它启动的窗口的句柄。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

MainWindowHandle属性可以帮助你:

Process[] processes = Process.GetProcessesByName("yourprocess.exe");

foreach (Process p in processes)
{
    IntPtr windowHandle = p.MainWindowHandle;
}