Quote:
Originally Posted by Wilfried Hi,
I'm not sure. Code: Process[] processes = Process.GetProcessesByName("MapPoint");
foreach (Process proc in processes)
if (proc.Handle == app)
But I'm not sure if the handle of the process is the same as the value of app. It can be the address of it. So if not I'm stuck as well. |
proc.Handle and app are not comparable types so this can't work.
So, maybe, this workaround is the best that can be done.
Code:
Process thisProcess = Process.GetCurrentProcess();
app.Caption = thisProcess.Id.ToString();
Process[] procesi = Process.GetProcessesByName("MapPoint");
foreach (Process p in procesi)
{
if (p.MainWindowTitle == "Map - "+thisProcess.Id.ToString())
{
//p is the one
}
}
Can it be done easier?