MFC下有没有相关的API?

解决方案 »

  1.   

    linux的话知道怎么办, 看看ps的源码就可以知道
    ps -eo pid,pmem,%cpu
    可以得到所有进程的mem和cpu使用情况windows的话,记得前面有一个帖子提到
    ntdll.dll文件中有个NtQuerySystemInformation函数
    http://community.csdn.net/Expert/TopicView3.asp?id=4392620
      

  2.   

    linux下, ps应该是直接读/proc下进程的信息的
      

  3.   

    我想windows下也应该有像ps那样的读取PCB信息的函数吧,CPU时间和占用内存数这个PCB里应该都有的,实现这样一个函数应该并不困难,关键就是不知道这个函数名叫什么
    MFC库里应该有吧?
      

  4.   

    GetProcessTimes不知道对你有没有用BOOL GetProcessTimes(
      HANDLE hProcess,           // specifies the process of interest
      LPFILETIME lpCreationTime, // when the process was created
      LPFILETIME lpExitTime,     // when the process exited
      LPFILETIME lpKernelTime,   // time the process has spent in kernel
                                 // mode
      LPFILETIME lpUserTime      // time the process has spent in user mode
    );
      

  5.   

    还有一个:VirtualQueryExThe VirtualQueryEx function provides information about a range of pages within the virtual address space of a specified process. DWORD VirtualQueryEx(
      HANDLE hProcess,    // handle to process
      LPCVOID lpAddress,  // address of region
      PMEMORY_BASIC_INFORMATION lpBuffer,
                          // address of information buffer
      DWORD dwLength      // size of buffer
    );也不知道对不对,没用过
      

  6.   

    Windows下有很多方式查看进程信息,比如toolhelp32系列API,PSAPI,甚至是NT native API