我坚持使用 IE8 的进程模型,其中一个用于我的 MFC 嵌入式窗口的 GetWindowThreadProcessId() 会给我一个子 IE PID,因为 GetWindowThreadProcessId() 我的容器页面会给我根 IE PID。
这很糟糕,因为我想在枚举窗口时过滤掉我的容器。
所以我正在寻找一种方法来获取给定进程的 parent 的 PID,以便从我的 MFC 应用程序中获取根 IE PID。
Sysinternals 的 ProcessExplorer我知道如何做到这一点,在 TreeView 中显示进程,所以我确信有办法实现这一点。
最佳答案
有没有seen this codeproject article或 this codeguru article ?
我认为更好的方法在 codeguru 文章中。
基本上您需要 PROCESS_BASIC_INFORMATION 的“ULONG InheritedFromUniqueProcessId”成员。参见 NtQueryInformationProcess和 this page .
关于c++ - 从进程导航到它的父进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/677722/