Source code buat nge-cek status memory

Disini kita membutuhkan 1 form dan satu timer. pad timer di set intervalnya jadi 200.. lalu di paste kod berikut ini pada form….

===============[Start Copy here ]==================
Option Explicit

Const SR = 0
Const GDI = 1
Const USR = 2
Const VER_PLATFORM_WIN32s = 0
Const VER_PLATFORM_WIN32_WINDOWS = 1
Const VER_PLATFORM_WIN32_NT = 2

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

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 Declare Function pBGetFreeSystemResources Lib “rsrc32.dll” _
Alias “_MyGetFreeSystemResources32@4” (ByVal iResType As Integer) As Integer

Private Declare Function GetVersionEx Lib “kernel32” _
Alias “GetVersionExA” (lpVersionInformation As OSVERSIONINFO) As Long

Private Sub Timer1_Timer()
Dim MS As MEMORYSTATUS
Dim OSInfo As OSVERSIONINFO

Me.Caption = “Memory Statistics/System Resources”

MS.dwLength = Len(MS)
Call GlobalMemoryStatus(MS)
With MS
lbl(0) = Format$(.dwTotalPhys / 1024, “#,###.##”)
lbl(1) = Format$(.dwAvailPhys / 1024, “#,###.##”)
lbl(2) = Format$(.dwTotalVirtual / 1024, “#,###.##”)
lbl(3) = Format$(.dwAvailVirtual / 1024, “#,###.##”)
lbl(4) = Format$(.dwTotalPageFile / 1024, “#,###.##”)
lbl(5) = Format$(.dwAvailPageFile / 1024, “#,###.##”)
lbl(6) = Format$(.dwMemoryLoad, “##0.00″) & ” %”
End With

OSInfo.dwOSVersionInfoSize = Len(OSInfo)
Call GetVersionEx(OSInfo)
If OSInfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
lblUser = CStr(pBGetFreeSystemResources(USR))
lblSystem = CStr(pBGetFreeSystemResources(SR))
lblGDI = CStr(pBGetFreeSystemResources(GDI))
Else
lblUser = “N/A”
lblSystem = “N/A”
lblGDI = “N/A”
End If

End Sub