In a button click event IEnumerable res;
System.Threading.Thread.Sleep(10000);
var windows = FindWindowsWithText("GrADS 2.0.2.oga.2");
GetWindowThreadProcessId(windows,out res)
Then FindWindowsWithText
public static IEnumerable<IntPtr> FindWindowsWithText(string titleText)
{
return FindWindows(delegate(IntPtr wnd, IntPtr param)
{
return GetWindowText(wnd).Contains(titleText);
});
}
Then in the variable windows i'm getting one count in this case and the handle number: [0] = 3343352
With this number 3343352 i need to find in the end the process in this case external process name and process mainwindowtitle.
Using this
IEnumerable<IntPtr> res;
Not sure if it's any good i thought to get the id and then somehow using the id to get the name and mainwindowtitle. I made a mess.