|
|
|
The GlobalMemoryStatus API function returns detailed information about the current load on the physical and virtual memory. You can use the following code to display the current amount of free memory: |
Click here to copy the following block | Dim ms As MEMORYSTATUS Dim msg As String ms.dwLength = Len(ms) GlobalMemoryStatus ms msg = "Total physical memory = " & GetKbytes(ms.dwTotalPhys) & vbCrLf & _ "Available physical memory = " & GetKbytes(ms.dwAvailPhys) & vbCrLf & _ "Memory Load = " & ms.dwMemoryLoad & "%" & vbCrLf & _ "Total Page file = " & GetKbytes(ms.dwTotalPageFile) & vbCrLf & _ "Available Page file = " & GetKbytes(ms.dwAvailPageFile) & vbCrLf & _ "Total Virtual memory = " & GetKbytes(ms.dwTotalVirtual) & vbCrLf & _ "Available Virtual memory = " & GetKbytes(ms.dwAvailVirtual) MsgBox msg, vbInformation, "Memory information"
The GetKbytes function is a simple routine that converts a number of bytes into Kbytes, and adds thousand separators:
Function GetKbytes(ByVal amount As Long) As String amount = amount \ 1024 GetKbytes = Format(amount, "###,###,###K") End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|