如何通过提供正在运行的进程名称来获取窗口句柄? [英] How to I get the window handle by giving the process name that is running?
本文介绍了如何通过提供正在运行的进程名称来获取窗口句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过在 c# 中给出进程名称或窗口标题来获取窗口句柄..鉴于进程已经在运行
How can I get the window handle by giving the process name or window title in c#.. given the process is in running already
推荐答案
您可以使用 Process
类.
Process[] processes = Process.GetProcessesByName("someName");
foreach (Process p in processes)
{
IntPtr windowHandle = p.MainWindowHandle;
// do something with windowHandle
}
这篇关于如何通过提供正在运行的进程名称来获取窗口句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文