How to I get the window handle by giving the process name that is running?

前端 未结 1 1729
清歌不尽
清歌不尽 2020-12-01 23:28

How can I get the window handle by giving the process name or window title in c#.. given the process is in running already

相关标签:
1条回答
  • You can use the Process class.

    Process[] processes = Process.GetProcessesByName("someName");
    
    foreach (Process p in processes)
    {
        IntPtr windowHandle = p.MainWindowHandle;
    
        // do something with windowHandle
    }
    
    0 讨论(0)
提交回复
热议问题