开发者

how to get the process name from the PID in C++? [duplicate]

This question already has answers here: Closed 11 years ago.

Possi开发者_如何学Cble Duplicate:

How to get Process Name in C++

I am looking for a way to to get the process name from the PID?

I need to translate process id (PID) to process name

any idea?


it depends on the used platform like Yahia mentioned in his comment.

on linux: you can get the command-line by reading that file: /proc/[PID]/cmdline

on windows: I've found this: get process name from process id (win32)


On Windows you can open the process using OpenProcess in order to get a handle to the process. After that you can get the process name with GetProcessImageFileName and close the handle (CloseHandle).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜