Detectar la RAM

ice_old
29 de Abril del 2004
Como se puede detectar la Ram con visual basic?

NyiNyo
29 de Abril del 2004
Tienes que hacerlo por medio de la api de windows.
Defines esto en un modulo:
Option Explicit

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

Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)

y un ejemplo en un formulario:
Option Explicit
Private Sub Form_Load()
Dim MemSts As MEMORYSTATUS
Dim Memory As Long, Msg As String

GlobalMemoryStatus MemSts

Memory = MemSts.dwTotalPhys
Msg = "Total Physical Memory: " & Format$(Memory 1024, "###,###,###") & " Kb" & vbCrLf & vbCrLf
Memory = MemSts.dwAvailPhys
Msg = Msg & "Available Physical Memory: " & Format$(Memory 1024, "###,###,###") & " Kb" & vbCrLf & vbCrLf
Memory = MemSts.dwTotalVirtual
Msg = Msg & "Total Virtual Memory: " & Format$(Memory 1024, "###,###,###") & " Kb" & vbCrLf & vbCrLf
Memory = MemSts.dwAvailVirtual
Msg = Msg & "Available Virtual Memory: " & Format$(Memory 1024, "###,###,###") & " Kb" & vbCrLf

MsgBox Msg, vbInformation
End Sub

espero que te sirva, un saludo.