Current process information
-
here is the problem which I come across with: I want to get process name ,application name and it's window title name with the code below
listView1.Columns.Add("CurrentProcess", 2000);
listView1.Columns.Add("CurrentProcessPID", 500);
listView1.Columns.Add("CurrentApplicationname", 2000);listView1.Items.Insert(1,Process.GetCurrentProcess().ToString());
listView1.Items.Insert(2,Process.GetCurrentProcess().MainWindowTitle);
listView1.Items.Insert(3,Process.GetCurrentProcess().Id.ToString());but when I run my code I get this result system.diagnostics.process(currentApplication on ByPId.vshost) form1 I enter this code to run in a timer tick so I use other application in the middle of this running code but I just get the result above. I would appreciate any commend
-
here is the problem which I come across with: I want to get process name ,application name and it's window title name with the code below
listView1.Columns.Add("CurrentProcess", 2000);
listView1.Columns.Add("CurrentProcessPID", 500);
listView1.Columns.Add("CurrentApplicationname", 2000);listView1.Items.Insert(1,Process.GetCurrentProcess().ToString());
listView1.Items.Insert(2,Process.GetCurrentProcess().MainWindowTitle);
listView1.Items.Insert(3,Process.GetCurrentProcess().Id.ToString());but when I run my code I get this result system.diagnostics.process(currentApplication on ByPId.vshost) form1 I enter this code to run in a timer tick so I use other application in the middle of this running code but I just get the result above. I would appreciate any commend
whenever your app does something, it IS the current process. Therefore, GetCurrentProcess() isn't going to help you getting information about other processes. The Process class does hold what you need, however, be aware there are a number of system processes you are not allowed to get information about (You would get some kind of access violation when you try). An alternative route would be using WMI, probably with the exact same limitations. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
whenever your app does something, it IS the current process. Therefore, GetCurrentProcess() isn't going to help you getting information about other processes. The Process class does hold what you need, however, be aware there are a number of system processes you are not allowed to get information about (You would get some kind of access violation when you try). An alternative route would be using WMI, probably with the exact same limitations. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
here is the problem which I come across with: I want to get process name ,application name and it's window title name with the code below
listView1.Columns.Add("CurrentProcess", 2000);
listView1.Columns.Add("CurrentProcessPID", 500);
listView1.Columns.Add("CurrentApplicationname", 2000);listView1.Items.Insert(1,Process.GetCurrentProcess().ToString());
listView1.Items.Insert(2,Process.GetCurrentProcess().MainWindowTitle);
listView1.Items.Insert(3,Process.GetCurrentProcess().Id.ToString());but when I run my code I get this result system.diagnostics.process(currentApplication on ByPId.vshost) form1 I enter this code to run in a timer tick so I use other application in the middle of this running code but I just get the result above. I would appreciate any commend
-
I second what Luc said above. Just as a hint, if you need information for the processes currently running on the local system, you could use the
Process.GetProcesses
static method. But I have to ask... What's wrong with Windows Task Manager?2A
-
thanks for your comment; I need it through a program .. what I mean here is currently running application but not this application;
Well, an application is just that - a process. If you mean you need the processes that Task Managers displays in the Applications tab - another hint - that's a process that has a
window
, and if it has a window it should have awindow handle
. Read about theProcess
class on MSDN, see what kind of properties and methods it has - the answer is all there (and here actually), so it's up to you to do the rest.2A