星期四, 九月 14, 2006

(VB.NET)获取物理内存大小

Imports System

Imports System.Management

Module Module1

Public Sub Main()

Dim strComputer = "ComputerName" '计算机名

Dim wbemServices, wbemObjectSet, wbemObject

wbemServices = GetObject("winmgmts:\\" & strComputer)

wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

For Each wbemObject In wbemObjectSet

Console.WriteLine("物理内存的大小 (kb):" & wbemObject.TotalPhysicalMemory)

Next

End Sub

End Module

没有评论: