Reputation: 21
there is a application with 5 windows. i have the PID of that process, and how can i get all WindowHandles of that Process?
thanks.
Upvotes: 2
Views: 487
Reputation: 14874
Get the MainWindowHandle and then call EnumChildWindows on it.
Maybe calling managed code will be better than PInvoke, you can find more here Managed Windows API
Upvotes: 1
Reputation: 9973
User something like this:
Process[] processes = Process.GetProcesses(".");
foreach (var process in processes)
{
var handle = process.MainWindowHandle;
}
Upvotes: 0