本文介绍了C ++ Windows OpenProcess问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个关于OpenProcess功能的严重问题()。



我需要该功能来获取所有进程处理,收集有关当前正在运行的进程的基本信息(进程名称,CPU使用情况,内存使用情况)。问题是当我构建我的应用程序的发布版本时,某些进程句柄无法使用此函数打开(调试版本成功打开这些句柄)。我尝试了几种解决方案,但其中一些有瓶颈。这个解决方案是:

- 初始化权限,还需要Open Process功能,失败的是我的应用程序无法打开自己的句柄。

- 尝试其他功能来获取进程名称和CPU使用率(这些都没问题)



不幸的是,我找不到另一种获取进程内存使用的方法,这就是OpenProcess需要解决的原因,但是如果你有一个想法,没有OpenProcess收集内存使用信息,请让我知道或解决OpenProcess失败。



很抱歉不共享程序代码,但其商业秘密目前。

Hi,

I have a serious problem about OpenProcess function (link to msdna).

I need that function to get all process handles, to collect basic information (process name, cpu usage, memory usage) about the currently running processes. The problem is when I build a release version of my application some process handle cannot be opened with this function (debug version open these handles succesfully). I've tried several solution, but some of them have a bottleneck. This "solutions" was:
- Initialize privileges, also need Open Process function, the failure was my application cannot open its own handle.
- Tried other function to get process name and cpu usage (these are ok)

Unfortunately, I cannot found another way to get memory usage of processes, thats is why OpenProcess needs to be solved, but if you have an idea to collect memory usage info without OpenProcess please let me know that or solve the OpenProcess failure.

Sorry about not sharing the program code, but its trade secret currently.

推荐答案


这篇关于C ++ Windows OpenProcess问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 12:08