问题
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
来源:https://stackoverflow.com/questions/1347732/get-task-manager-list-via-swt