Why does Process.MainWindowTitle sometimes don't work ?

Hello, I want to get informations about the title of processes on remote machines. On some machines (Win2000) the Method Process.GetProcesses() does return informations about running processes, but on some machines (WinNT) I get an exception. Furthermore the Method process.MainWindowTitle() does not return informations for remote processes. Here comes my code: Process process = null; foreach(Process proc in Process.GetProcesses("L1332020")){ MessageBox.Show(proc.ProcessName.ToString()); if(proc.MainWindowTitle.ToString().StartsWith("SessionB")){ process = proc; break; } } if(process==null) MessageBox.Show("No suitable Process found!"); else{ DKC_DllImport.BringWindowToTop (process.MainWindowHandle); DKC_DllImport.ShowWindow(process.MainWindowHandle, 9); //9 = SW_RESTORE } Does anybody have a solution for this problem that works ? Thanks, Timo

1 Reply

AD Administrator Syncfusion Team April 9, 2003 03:32 AM UTC

> Hello, > > I want to get informations about the title of processes on remote machines. On some machines (Win2000) the Method Process.GetProcesses() does return informations about running processes, but on some machines (WinNT) I get an exception. > > Furthermore the Method process.MainWindowTitle() does not return informations for remote processes. > > Here comes my code: > > Process process = null; > foreach(Process proc in Process.GetProcesses("L1332020")){ > MessageBox.Show(proc.ProcessName.ToString()); > if(proc.MainWindowTitle.ToString().StartsWith("SessionB")){ > process = proc; > break; > } > } > > if(process==null) > MessageBox.Show("No suitable Process found!"); > else{ > DKC_DllImport.BringWindowToTop (process.MainWindowHandle); > DKC_DllImport.ShowWindow(process.MainWindowHandle, 9); //9 = SW_RESTORE > } > > Does anybody have a solution for this problem that works ? > > Thanks, Timo

Loader.
Up arrow icon