Sub test()
Dim objOS
On Error Resume Next
' Connect to WMI and obtain instances of Win32_OperatingSystem
For Each objOS In GetObject( _
"winmgmts:").InstancesOf("Win32_OperatingSystem")
MsgBox "Memoire = " & objOS.TotalVisibleMemorySize
Next
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
End If
End Sub
...determine how much RAM is installed in a computer? Use the Win32_ComputerSystem class and check the value of the TotalPhysicalMemory property.
VB
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
Wscript.Echo "System Name: " & objComputer.Name
Wscript.Echo "Total Physical Memory: " & _
objComputer.TotalPhysicalMemory
Next
la source est toujours la même
StrResults = StrResults & " Mémoire (RAM) installée Lone-Wolf : " & Application.WorksheetFunction.Round(((objC.TotalVisibleMemorySize / 1024) / 1024), 0) & " Go" & vbCrLf & vbCrLf
Nom de l'ordinateur: DAVID-PC
Edition: Microsoft Windows 7 Édition Familiale Premium
Version: 6.1.7601
Processeur : Intel(R) Core(TM) i5-2400S CPU @ 2.50GHz - 64 bits
Mémoire (RAM) installée 6,34.00 Go
Service Pack 1
Sub a() 'renvoie 32 sur un PC sous XP HOME SP3)
Dim OSVER
Set OSVER = GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'")
MsgBox OSVER.addresswidth & "-bit"
End Sub
Sub test()
MsgBox Application.OperatingSystem
End Sub
Pourquoi chez vous le résultat est faussé? Est-ce que les paramètres régionaux France pour vous et Suisse pour moi, font qu'il y ai cette différence??