NT Only - Use PSAPI.DLL to get a complete task list and Process Memory Usage
Download the Task View project files (15kb)
Download the PSAPI.DLL declarations module (2kb)
PSAPI.DLL is a DLL provided with the Win32 SDK which greatly simplifies the job of
getting a task list and memory usage information under NT. This information is available
in the dyamic data section of the registry, but the format is fairly obstructive and its
a considerable task to extract it programmatically.
This sample application provides a translation of the PSAPI DLL functions and structs to VB declares
and types and also provides a simple but comprehensive demonstration of how to call
the functions. You can get full memory statistics for virtually all running processes,
(not the System and Idle processes) including swap file usage, working set size etc, and you
can also list all DLLs loaded in the working set of a particular process.
You could use this code for memory usage checking
whilst debugging VB server apps. Or use it to log memory usage and take preventative action.
Just wrap the EnumProcesses and memory usage functions into
a class, compile into a ActiveX EXE and it will easy to return the memory usage for the EXE in
Back to top
Back to Source Code Overview