【问题标题】:get the list of programs currently running on Windows or Ubuntu获取当前在 Windows 或 Ubuntu 上运行的程序列表
【发布时间】:2013-10-01 06:36:02
【问题描述】:

我想获取在 Windows 任务管理器的应用程序选项卡中显示的程序列表(包括应用程序图标及其名称),我想知道我应该使用哪些 Windows API?

如果我想在 Ubuntu 上做同样的事情,那么我应该使用哪些 Ubuntu API?

【问题讨论】:

标签: python windows qt winapi ubuntu


【解决方案1】:

对于 Ubuntu,你可以看到这篇文章:

How to get list opened windows in PyGTK or GTK in Ubuntu?

对于你有 WMI 模块的 Windows,你可以看到这篇文章:

I'm trying to get all the processes and applications that are currently running using Python on Windows 7

【讨论】:

    【解决方案2】:

    Afaik Qt 本身不允许您这样做,至少在以前的版本中不允许这样做。要在 windows 上解决这个问题,你必须使用 win-api EnumProcesses,而在 linux 中你可以使用 /proc 文件系统,它包含有关正在运行的进程的信息

    【讨论】:

    • 我的可能会使用 c++ 而不是仅使用 python
    【解决方案3】:

    您可以考虑使用herehere 中的psutil 库,它提供了一组跨平台工具,包括ps

    【讨论】:

      猜你喜欢
      • 2018-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-06
      相关资源
      最近更新 更多