列出所有进程?

列出所有进程?,第1张

概述列出所有进程

怎样才能使用JNA 4.5.0获得Java中所有正在运行的进程的列表?

我已经试过这个代码:

WinNT winNT = (WinNT) Native.loadlibrary(WinNT.class,W32APIOptions.UNICODE_OPTIONS); winNT.HANDLE snapshot = winNT.Createtoolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS,new WinDef.DWORD(0)); Thelp32.PROCESSENTRY32.ByReference processEntry = new Tlhelp32.PROCESSENTRY32.ByReference(); while (winNT.Process32Next(snapshot,processEntry)) { System.out.println(processEntry.th32ProcessID + "t" + Native.toString(processEntry.szExefile)); } winNT.CloseHandle(snapshot);

但是它不能正常工作,因为它是为较早版本的JNA库编写的。

如何持续监控linux中的进程创build?

英特尔和AMD处理器的PROCESSOR_ARCHITECTURE的registry值exception

ps -A |的等价物 windows中的grep -c进程?

windows中的Perl kill(0,$ pID)总是返回1

是否有可能读/写内存到Lua的另一个进程?

在linux内核4.8.0-53-通用linux Mint 64位中,从IOCTL函数的不兼容指针初始化错误

如何检查给定PID的进程是否正在运行?

在windows上使用Ruby的popen3或等效

学习Unix和C – 查看进程,文件和v节点表

将值存储在独立于进程的内存中

现在你正在寻找的一些功能存在于coreel32类中。 通过一些小的更正,你的代码片段工作得很好:

import com.sun.jna.Native; import com.sun.jna.platform.win32.coreel32; import com.sun.jna.platform.win32.Tlhelp32; import com.sun.jna.platform.win32.WinDef; import com.sun.jna.platform.win32.WinNT; public class Main { public static voID main(String[] args) { coreel32 kernel = coreel32.INSTANCE; WinNT.HANDLE snapshot = kernel.Createtoolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS,new WinDef.DWORD(0)); Tlhelp32.PROCESSENTRY32.ByReference processEntry = new Tlhelp32.PROCESSENTRY32.ByReference(); while (kernel.Process32Next(snapshot,processEntry)) { System.out.println(processEntry.th32ProcessID + "t" + Native.toString(processEntry.szExefile)); } kernel.CloseHandle(snapshot); } }

总结

以上是内存溢出为你收集整理的列出所有进程?全部内容,希望文章能够帮你解决列出所有进程?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1257356.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存