Available applications in Taskmanager

  • Thread starter Thread starter Kondapanaidu
  • Start date Start date
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
 
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
 
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
 
Back
Top