by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 1st November 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Get the amount of physical and virtual memory free,used using GlobalMemoryStatus API
API Declarations
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)
Dim xmem As MEMORYSTATUS
Dim amem, pmem, avirt, tvirt As Long
GlobalMemoryStatus xmem
amem = xmem.dwAvailPhys
pmem = xmem.dwTotalPhys
avirt = xmem.dwAvailVirtual
tvirt = xmem.dwTotalVirtual
MsgBox "Total Physical Memory is " & Format(pmem / 1024, "###,###,###") & " KB" & Chr(13) & "Available Physical Memory is " & Format(amem / 1024, "###,###,###") & " KB" & _
Chr(13) & Chr(13) & "Total Virtual Memory is " & Format(tvirt / 1024, "###,###,###") & " KB" & Chr(13) & "Available Virtual Memory is " & Format(avirt / 1024, "###,###,###") & " KB"
End
End Sub
No comments have been posted about Get the amount of physical and virtual memory free,used using GlobalMemoryStatus API. Why not be the first to post a comment about Get the amount of physical and virtual memory free,used using GlobalMemoryStatus API.