Private Sub Command1_Click()
Dim MemSta As MEMORYSTATUS
Dim TotalPhys As Long '物理メモリ
Dim TotalVirtual As Long'仮想メモリ
Dim AvailPhys As Long '空き物理メモリ
Dim AvailVirtual As Long'空き仮想メモリ
Dim msg As String
'関数を呼び出す前に引数の構造体のサイズを格納しなくてはいけない
MemSta.dwLength = Len(MemSta)
Call GlobalMemoryStatus(MemSta)
TotalPhys = MemSta.dwTotalPhys
AvailPhys = MemSta.dwAvailPhys
TotalVirtual = MemSta.dwTotalVirtual
AvailVirtual = MemSta.dwAvailVirtual
Call GetMemInfo(TotalPhys, AvailPhys, TotalVirtual, AvailVirtual)
msg = "物理メモリ : " & TotalPhys & "バイト" & Chr(10) & _
"空き物理メモリ : " & AvailPhys & "バイト" & Chr(10) & _
"仮想メモリ : " & TotalVirtual & "バイト" & Chr(10) & _
"空き仮想メモリ : " & AvailVirtual & "バイト"
MsgBox msg, vbInformation + vbOKOnly, "メモリ情報"
End Sub
|