17-10-12, 01:06 AM
كاتب الموضوع : AhmedEssawy
نكتب في الموديولكود :
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
'This is the main function,
'which returns the correct
'values to the above TYPE
Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)كود :
Public TotalPhysicalMemory, AvailablePhysicalMemory, TotalPageFile, AvailablePageFile, TotalVirtualMemory, AvailableVirtualMemory As Longكود :
Public Function GetMemoryStats()
Dim ms As Module1.MEMORYSTATUS
Module1.GlobalMemoryStatus ms
TotalPhysicalMemory = ms.dwTotalPhys \ 1024
AvailablePhysicalMemory = ms.dwAvailPhys \ 1024
TotalPageFile = ms.dwTotalPageFile \ 1024
AvailablePageFile = ms.dwAvailPageFile \ 1024
TotalVirtualMemory = ms.dwTotalVirtual \ 1024
AvailableVirtualMemory = ms.dwAvailVirtual \ 1024
End Functionكود :
GetMemoryStatsكود :
Label1.Caption = "You have " & TotalPhysicalMemory & " KB of RAM"كود :
Label2.Caption = "of which " & AvailablePhysicalMemory & " KB are not used"