Available applications in Taskmanager

K

Kondapanaidu

Hi,

I am using C#.NETV1.1


How will we list which are the applications running under a task
manager.

Thanks in advance
 
G

Guest

You need to use API function EnumWindows() to gel list

public delegate bool CallBackPtr(int hwnd, int lParam);

public class EnumReport
{
[DllImport("user32.dll")]
public static extern int EnumWindows(CallBackPtr callPtr, int lPar);
public static bool Report(int hwnd, int lParam)
{
Console.WriteLine("Window handle is "+hwnd);
return true;
}
}
void Main()
{
CallBackPtr callBackPtr = new CallBackPtr(EnumReport.Report);
EnumReport.EnumWindows(callBackPtr, 0);
}

I am using C#.NETV1.1
How will we list which are the applications running under a task
manager.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
G

Guest

Another way is to get the list of processes

Process [] localAll = Process.GetProcesses();

and get the window associated with it

Process.MainWindowHandle
I am using C#.NETV1.1


How will we list which are the applications running under a task
manager.

Thanks in advance

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top