المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : [SOLVED] Process ID



C# Programming
06-23-2009, 01:50 PM
Hi all,

I want to find the process ID, on one of my application. I want to do this, because later on I want to kill those process as well. I decide to use the process ID, because my application can run multiple time. Say the notepad. I can open multiple notepad docs and each have separate PIDs.

So I tried this.

Process[] servers = Process.GetProcessesByName("notepad.exe");
for (int index = 0; index < servers.Length; index++)
{
int id = servers[index].Id;
}

But each time, Process array length is zero. Even I've open multiple notepads.

Can anyone comment on this.

Thanks a lot http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

I appreciate your help all the time...
CodingLover http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif

modified on Tuesday, June 23, 2009 5:46 AM