Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleGet system memory information
Keywordsmemory, system memory, resources
CategoriesUtilities, Windows
 
Use the GlobalMemoryStatus API function.
 
Private Sub ShowStatistics()
Dim mem As MEMORYSTATUS
Dim txt As String

    GlobalMemoryStatus mem

    With mem
        txt = txt & "% used:                " & _
            Format$(.dwMemoryLoad, "@@@@@@@@@@@") & vbCrLf
        txt = txt & "Total physical memory: " & _
            Format$(.dwTotalPhys, "@@@@@@@@@@@") & vbCrLf
        txt = txt & "Physical memory free:  " & _
            Format$(.dwAvailPhys, "@@@@@@@@@@@") & vbCrLf
        txt = txt & "Total page file size:  " & _
            Format$(.dwTotalPageFile, "@@@@@@@@@@@") & _
            vbCrLf
        txt = txt & "Free page file size:   " & _
            Format$(.dwAvailPageFile, "@@@@@@@@@@@") & _
            vbCrLf
        txt = txt & "Total virtual memory:  " & _
            Format$(.dwTotalVirtual, "@@@@@@@@@@@") & vbCrLf
        txt = txt & "Free virtual memory:   " & _
            Format$(.dwAvailVirtual, "@@@@@@@@@@@") & vbCrLf
    End With

    Label1.Caption = txt
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated