How can I have a dialog box display the users available memory?
Thanks
Printable View
How can I have a dialog box display the users available memory?
Thanks
maybe the GlobalMemoryStatusEx function, see http://www.vbapi.com Will post some code in a little while,
Use the GlobalMemoryStatus, unless more than 4GB!!! of RAM!!!!, then use Ex
i found this at http://www.vbapi.comCode:'in a module
Public Declare Sub GlobalMemoryStatus Lib "kernel32" Alias "GlobalMemoryStatus" (lpBuffer As MEMORYSTATUS)
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 Sub GetMemory()
' Display the amounts of total and available physical memory
' on the computer. Also calculate the percentage of used physical memory.
Dim ms As MEMORYSTATUS
' Get the current memory status.
GlobalMemoryStatus ms
' Display total and available physical memory, in KB.
Debug.Print "Total Physical Memory:"; ms.dwTotalPhys \ 1024; "KB"
Debug.Print "Available Physical Memory:"; ms.dwAvailPhys \ 1024; "KB"
' Calculate percentage of physical memory in use.
Debug.Print "Used Physical Memory:"; 100 - 100 * ms.dwAvailPhys \ ms.dwTotalPhys; "%"
end sub
'usage
GetMemory