开发者

C++ scanning process ids using the command prompt with tasklist

I'm trying to use开发者_Python百科 c++ to scan in the processes shown in the command prompt of windows when you type in tasklist. I haven't have the whole code ready but would like help in trying to read in the processes.


Well you can redirect the standard output, orrrr you can use winapi =)

List of functions to do with processes: http://msdn2.microsoft.com/en-us/library/ms684847.aspx

EnumProcesses function: http://msdn.microsoft.com/en-us/library/ms682629.aspx


You'll need to use PSAPI to do this. You may need to add psapi.lib to your library dependencies.

You can use EnumProcesses to fill an array with the IDs of all running processes. You can then use OpenProcess with the IDs in your array to retrieve a handle to each running process, then pass the handle to the relevant functions, such as QueryWorkingSet to get information about each process.

You can most likely find examples on the MSDN, if you need more help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜