求教:怎样列举出进程的所有子进程

HisinWang 2014-09-15 03:16:05
在Windows中,
怎样列举出进程的所有子进程。

如:进程A中,通过CreateProcess创建了进程B,则进程B就是进程A的子进程。
如果可以,能给出完整代码那就感激不尽了。
...全文
235 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
HisinWang 2014-09-21
  • 打赏
  • 举报
回复
谢谢各位了 谢谢各位了
schlafenhamster 2014-09-16
  • 打赏
  • 举报
回复
CreateProcess function Creates a new process and its primary thread. The new process runs in the security context of the calling process. If the calling process is impersonating another user, the new process uses the token for the calling process, not the impersonation token. To run the new process in the security context of the user represented by the impersonation token, use the CreateProcessAsUser or CreateProcessWithLogonW function.
看不见的裂痕 2014-09-16
  • 打赏
  • 举报
回复
查进程映射 获取PROCESSENTRY32结构体,里面有th32ParentProcessID,就是你这里所说的东西了 链接
schlafenhamster 2014-09-16
  • 打赏
  • 举报
回复
linux 的 fork 可以产生子进程.
91program 2014-09-16
  • 打赏
  • 举报
回复
进程中只有线程,不可能进程中还有进程。 所以 LZ 想要的,至少在 WinCE 下是不支持的。可以考虑在进程中创建线程来满足 LZ 的要求。
91program 2014-09-16
  • 打赏
  • 举报
回复
进程A中,通过CreateProcess创建了进程B,则进程B就是进程A的子进程。 >>>不是这样的,进程A和进程B是同级的,不存在进程Bj进程A的子进程这一说。
阿呆_ 2014-09-15
  • 打赏
  • 举报
回复
用tool help系列函数可以获取。 msdn上有完整例子:Taking a Snapshot and Viewing Processes 你的要求可能稍有不同但是改改例子还是很容易的,不过就是用列表记录下所以进程信息,然后判断里面theParentProcessId == 你需要的父进程id的那些进程而已

15,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧