Finding info about a process, like Process Viewer/Viewer, WinTop 
Author Message
 Finding info about a process, like Process Viewer/Viewer, WinTop

How can I get CPU %, memory usage, and other useful stuff like that?


Bodi Klamph
Azure Dragon Software

begin 666 Bodi Klamph.vcf
M;V1I($ML86UP: T*3U)'.D%Z=7)E($1R86=O;B!3;V9T=V%R90T*5$E43$4Z


2,3(U.5H-"D5.1#I60T%21 T*

Sat, 13 Jan 2001 03:00:00 GMT  
 Finding info about a process, like Process Viewer/Viewer, WinTop


>How can I get CPU %, memory usage, and other useful stuff like that?


>Bodi Klamph
>Azure Dragon Software


This should get you started on getting Memory Info:

Place the code below in a class:

    dwLength As Long
    dwMemoryLoad As Long
    dwTotalPhys As Long
    dwAvailPhys As Long
    dwTotalPageFile As Long
    dwAvailPageFile As Long
    dwTotalVirtual As Long
    dwAvailVirtual As Long
End Type

Private Declare Sub GlobalMemoryStatus Lib "kernel32" _
   (lpBuffer As MEMORYSTATUS)

Private mMemoryUsed As Long
Private mTotalPhysicalMemory As Long
Private mAvailablePhysicalMemory As Long
Private mTotalPagingFile As Long
Private mAvailablePagingFile As Long
Private mPercentageDriveUsed As Single
Private mTotalBytes As Long
Private mBytesFreeToCaller As Long
Private mTotalFreeBytes As Long

Public Sub GetStatus()

   mMS.dwLength = Len(mMS)
   GlobalMemoryStatus mMS

   'fill properties
   mMemoryUsed = mMS.dwMemoryLoad
   mTotalPhysicalMemory = mMS.dwTotalPhys
   mAvailablePhysicalMemory = mMS.dwAvailPhys
   mTotalPagingFile = mMS.dwTotalPageFile
   mAvailablePagingFile = mMS.dwAvailPageFile

End Sub

Now just create properties to expose the private members...

Public Property Get MemoryUsed() As Long
    MemoryUsed = mMemoryUsed
End Property
Public Property Get TotalPhysicalMemory() As Long
    TotalPhysicalMemory = mTotalPhysicalMemory
End Property
Public Property Get AvailablePhysicalMemory() As Long
    AvailablePhysicalMemory = mAvailablePhysicalMemory
End Property
Public Property Get TotalPagingFile() As Long
    TotalPagingFile = mTotalPagingFile
End Property
Public Property Get AvailablePagingFile() As Long
    AvailablePagingFile = mAvailablePagingFile
End Property

The values are returned in bytes...

  (You don't have to create a class to do this.  It's just that I've already
created a class just for this and
kinda copied and pasted to answer your question)

Hasta Luego

To send me email remove the zzz (s) from the email address
Do not click the Reply button

Sat, 13 Jan 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Difference between task manager and process viewer for terminating windows explorer

2. Using Process Viewer of Visual Studio ?

3. Process Viewer

4. Find Process by process name

5. JPEG info-viewer VBX (height, width etc)

6. Problem with Page Header info missing in Viewer

7. Bypass Info Viewer Logon Window from Application

8. Can't find constant value in API Viewer

9. set wallpaper to tile - cannot find ref in API viewer

10. Need to Find a HTML Viewer, putting a book on cd

11. Error using Viewer ('String found)

12. Physical Database not found!! - smart viewer message


Powered by phpBB® Forum Software