通过 SWT 获取任务管理器列表? [英] Get task manager list via SWT?

查看:52
本文介绍了通过 SWT 获取任务管理器列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 SWT 获取当前正在运行的所有进程的列表(类似于在 Windows 上执行 tasklist.exe/tlist.exe)?如果是这样,是否有可用的示例代码?

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).

我的应用监控进程列表,需要支持Windows 2000/Server 2003/XP Home/XP Pro/Vista

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

提前致谢.

推荐答案

这似乎不可能使用 SWT,甚至 Java 都不适合跨多个平台.我最终使用 JNI 来列出正在运行的任务.这适用于我需要的所有操作系统.我在下面的地址中找到了一个很好的工作示例,并将其集成到我的应用程序中.实现了多项功能,例如列出进程、终止进程、查找特定 EXE 是否正在运行等.希望这对未来的人有所帮助.

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

这篇关于通过 SWT 获取任务管理器列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆