從 msdn 摘錄
Collecting Memory Usage Information For a Process
view plain
C++:
<div>
<pre>#include <windows.h>
#include <stdio.h>
#include "psapi.h"
void PrintMemoryInfo( DWORD processID )
{
HANDLE hProcess;
PROCESS_MEMORY_COUNTERS pmc;
// Print the process identifier.
printf( "\nProcess ID: %u\n", processID );
// Print information about the memory usage of the process.
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION
[...]