The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
3 Code Libraries Source Code &nbsp


NOTE: this code has been superceded by the version at the new site.



&nbsp

NT Only - Use PSAPI.DLL to get a complete task list and Process Memory Usage

VB Task Viewer Using PSAPI.DLL

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.

Viewing DLLs in the Working set of the task view application

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 question.



Back to top

Back to Source Code Overview

&nbsp

AboutContributeSend FeedbackPrivacy

Copyright 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 16 August 1998