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)
Private Sub cGlobalMemoryStatus()
Dim V As MEMORYSTATUS, PhyMem$, AvailMem$, VirMem$, AvailVirMem$
Dim PagMem$, AvailPagMem$, LoadMem$, Info$
V.dwLength = Len(V)
GlobalMemoryStatus V
PhyMem = V.dwTotalPhys: AvailMem = V.dwAvailPhys
VirMem = V.dwTotalVirtual: AvailVirMem = V.dwAvailVirtual
PagMem = V.dwTotalPageFile: AvailPagMem = V.dwAvailPageFile
LoadMem = V.dwMemoryLoad
Info = Info & "Total Physical Memory: "
Info = Info & Format$(PhyMem \ 1024, "###,###,###") & "K" & vbCrLf
Info = Info & "Available Physical Memory: "
Info = Info & Format$(AvailMem \ 1024, "###,###,###") & "K" & vbCrLf
Info = Info & "Percentage of Memory in use: " & LoadMem & "%" & vbCrLf
Info = Info & "Maximum Paging File Size: "
Info = Info & Format$(PagMem \ 1024, "###,###,###") & "K" & vbCrLf
Info = Info & "Kilobytes Avaiable in Paging File: "
Info = Info & Format$(AvailPagMem \ 1024, "###,###,###") & "K" & vbCrLf
Info = Info & "Total Virtual Memory: "
Info = Info & Format$(VirMem \ 1024, "###,###,###") & "K" & vbCrLf
Info = Info & "Available Virtual Memory: "
Info = Info & Format$(AvailVirMem \ 1024, "###,###,###") & "K" & vbCrLf & vbCrLf
MsgBox Info, vbOKOnly + vbInformation
End Sub |
|