Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 OS X 中以编程方式(在 C 或 Obj C 中)获取前台应用程序的 PID。
如何解决以下问题?
这应该这样做:
pid_t pid=NSWorkspace.sharedWorkspace.frontmostApplication.processIdentifier;
... 以更一般的方式,使用终端,输入“ top ”将显示所有当前活动的进程,它们的 PID、正常运行时间、CPU 使用率 [....]...