I would like to read the Active applications running in Task Manager (Applications Tab).
I have tried the code
Runtime.getRuntime().exec("tasklist.exe /nh")
which is getting the processes that are active but i need the Active applications,
I would like to read the Active applications running in Task Manager (Applications Tab).
I have tried the code
Runtime.getRuntime().exec("tasklist.exe /nh")
which is getting the processes that are active but i need the Active applications,
On
You can get close to what you want, but not likely exactly what you want by using creative filtering to "weed out" the processes that aren't likely in the Applications tab, but you'll still be presented with the process information.
Try this command:
tasklist /V /FI "STATUS eq RUNNING" /FI "Windowtitle ne N/A" /FI "Username eq <your username>" /FI "Memusage gt 15000"
The active application is notepad.exe. Looks like you want/need the current title of the application. This can be done by executing
wmicprogram andprocesscommand. You can do this in Java usingProcessBuilderandProcess. Code adapted from Detect if a process is running using WMIC: