CodeItBetter Programming Another VB Programming Blog

How to get amount Of free And used memory

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'System & API - How to get amount Of free And used memory

Public 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
Public Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
 
Private Sub Main()
    Dim MS As MEMORYSTATUS
    MS.dwLength = Len(MS)
    GlobalMemoryStatus MS
    'MS.dwMemoryLoad contains percentage memory used
    'MS.dwTotalPhys contains total amount of physical memory in bytes
    'MS.dwAvailPhys contains available physical memory
    'MS.dwTotalPageFile contains total amount of memory in the page file
    'MS.dwAvailPageFile contains available amount of memory in the page file
    'MS.dwTotalVirtual contains total amount of virtual memory
    'MS.dwAvailVirtual contains available virtual memory
    MsgBox MS.dwAvailPhys & " available physical memory"
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.