Is there an API call to return the amount of system resources free/used etc?
Printable View
Is there an API call to return the amount of system resources free/used etc?
this code (from the vb world library) will show
various bits of memory information, if that is what you are after.
Option Explicit
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)
Const fmt As String = "###,###,###,###"
Const skb As String = " Kbyte"
Const nkb As Long = 1024
Private Sub Form_Load()
Dim MS As MEMORYSTATUS
MS.dwLength = Len(MS)
GlobalMemoryStatus MS
lbMemStat(0) = Format$(MS.dwMemoryLoad, fmt) & " % used"
lbMemStat(1) = Format$(MS.dwTotalPhys / nkb, fmt) & skb
lbMemStat(2) = Format$(MS.dwAvailPhys / nkb, fmt) & skb
lbMemStat(3) = Format$(MS.dwTotalPageFile / nkb, fmt) & skb
lbMemStat(4) = Format$(MS.dwAvailPageFile / nkb, fmt) & skb
lbMemStat(5) = Format$(MS.dwTotalVirtual / nkb, fmt) & skb
lbMemStat(6) = Format$(MS.dwAvailVirtual / nkb, fmt) & skb
End Sub