Get task manager list via SWT?

2019-08-27 03:15发布

问题:

Is there a way using SWT to get a list of all processes currently running (similar to executing tasklist.exe/tlist.exe on Windows)? If so, is there sample code available?

Ideally this would be done programmatically only (no third party tools).

My app monitors the process list and needs to support Windows 2000/Server 2003/XP Home/XP Pro/Vista

Thanks in advance.

回答1:

This does not seem to be possible using SWT or even Java for that matter is a poor fit across multiple platforms. I ended up using JNI to list the running tasks. This works across all OS that I required. I found a good working example at the address below that I integrated into my app. Has multiple features implemented such as listing processes, killing processes, finding if specific EXE is running, and more. Hope this helps someone in the future.

http://www.codeproject.com/KB/java/jnisample.aspx