|
|
|
|
|
Dicas
|
|
Visual Basic (Windows)
|
|
|
Título da Dica: Exibir o total de memória no computador atual
|
|
|
|
Postada em 7/7/2003 por Ronaldão
Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type
Private Type MEMORYSTATUS dwLength As Long ' 32 dwMemoryLoad As Long ' percent of memory In use dwTotalPhys As Long ' bytes of physical memory dwAvailPhys As Long ' free physical memory bytes dwTotalPageFile As Long ' bytes of paging file dwAvailPageFile As Long ' free bytes of paging file dwTotalVirtual As Long ' user bytes of address Space dwAvailVirtual As Long ' free user bytes End Type
Private Type SYSTEMTIME wYear As Long wMonth As Long wDayOfWeek As Long wDay As Long wHour As Long wMinute As Long wSecond As Long wMilliseconds As Long End Type
Private Declare Sub GetSystemTime Lib "KERNEL32" (lpSystemTime As SYSTEMTIME) Private Declare Sub GlobalMemoryStatus Lib "KERNEL32" (lpmstMemStat As MEMORYSTATUS) Private Declare Function GetFocus& Lib "user32" () Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal message&, ByVal wParam&, lParam As Any) Private Declare Function SendMessageByString& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) Private Declare Function SystemTimeToFileTime Lib "KERNEL32" (lpSystemTime As SYSTEMTIME, lpFileTime As FILETIME) As Long
'Para poder usar esta API use a função abaixo: Public Function ListarMemoria() As String Dim ms As MEMORYSTATUS ms.dwLength = Len(ms) GlobalMemoryStatus ms
ListarMemoria = "Memória Física Total: " & Str(ms.dwTotalPhys) & Chr(10) & "Memória Física Avaliada: " & Str(ms.dwAvailPhys) End Function
|
|
|
|
|