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?

Thanks,

--
Bodi Klamph
Azure Dragon Software

begin 666 Bodi Klamph.vcf
M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..DML86UP:#M";V1I#0I&3CI"
M;V1I($ML86UP: T*3U)'.D%Z=7)E($1R86=O;B!3;V9T=V%R90T*5$E43$4Z

M.SL[.T]N=&%R:6\[.T-A;F%D80T*3$%"14P[5T]22SM%3D-/1$E.1SU154]4
M140M4%))3E1!0DQ%.D]N=&%R:6\],$0],$%#86YA9&$-"D%$4CM(3TU%.CL[
M.SL[.T-A;F%D80T*3$%"14P[2$]-13I#86YA9&$-"D5-04E,.U!2148[24Y4

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



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

Quote:

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

>Thanks,

>--
>Bodi Klamph
>Azure Dragon Software

Bodi,

This should get you started on getting Memory Info:

Place the code below in a class:

Private Type MEMORYSTATUS
    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 mMS 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
am

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