2

I'm making an application which is like windows task manager. For that, I need the list of all opened applications (not processes), which are shown in taskbar.

mak
  • 141
  • 6

2 Answers2

0

Here are some sources to look into:

http://www.daniweb.com/web-development/jsp/threads/93197

http://java.ittoolbox.com/groups/technical-functional/java-l/java-code-required-to-access-task-manager-569041

http://www.sqaforums.com/showflat.php?Cat=0&Number=658713&an=0&page=6

Looks like you'll be using the Runtime class.

CFL_Jeff
  • 2,589
  • 3
  • 31
  • 49
0

None of your links CFL_Jeff says anything of how to get active application windows (which I assume is what you want?

Don't think this can be accomplished with java or a simple windows commandline.

Here might be a way to do it in C#: Get the list of opened windows C#

Or you might have to take a look here: http://msdn.microsoft.com/en-us/library/windows/desktop/ff468919%28v=vs.85%29.aspx

An emergency solution might be to use the "tasklist /v" command and get all processes that have a "windowtitle" that differ from "I/T"(might be locale dependent), but that will give you tray icons aswell I'm afraid.

Edit: To get the tasklist, you can use the following:

try
{
    Process p = Runtime.getRuntime().exec("cmd /c tasklist /v");
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String input;
    while ((input = stdInput.readLine()) != null)
    {
        output += input;
    }
    stdInput.close();
}
catch(Exception k){JOptionPane.showMessageDialog(null, k.getMessage());}
Community
  • 1
  • 1
Martin
  • 1,130
  • 10
  • 14