VBA/Excel/Access/Word/Windows API/System Memory — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:48, 26 мая 2010
Get System Memory Size
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
Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Declare Sub abGlobalMemoryStatus Lib "kernel32" Alias "GlobalMemoryStatus" (lpBuffer As MEMORYSTATUS)
Sub GetSysInfo()
Dim intMousePresent As Integer
Dim strBuffer As String
Dim intLen As Integer
Dim MS As MEMORYSTATUS
Dim SI As SYSTEM_INFO
"Set the length member before you call GlobalMemoryStatus
MS.dwLength = Len(MS)
abGlobalMemoryStatus MS
Debug.Print "MemoryLoad" & MS.dwMemoryLoad & "%"
Debug.Print "TotalPhysical" & Format(Fix(MS.dwTotalPhys / 1024), "###,###") & "K"
Debug.Print "AvailablePhysical" & Format(Fix(MS.dwAvailPhys / 1024), "###,###") & "K"
Debug.Print "TotalVirtual" & Format(Fix(MS.dwTotalVirtual / 1024), "###,###") & "K"
Debug.Print "AvailableVirtual" & Format(Fix(MS.dwAvailVirtual / 1024), "###,###") & "K"
End Sub