如果在c#中给出进程名称或窗口标题,我该如何获取窗口句柄...给定进程已在运行
答案 0 :(得分:41)
您可以使用Process
类。
Process[] processes = Process.GetProcessesByName("someName");
foreach (Process p in processes)
{
IntPtr windowHandle = p.MainWindowHandle;
// do something with windowHandle
}