Dim searcher As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher()
searcher.Query = New System.Management.SelectQuery(WindowsAPIType.Win32_PhysicalMemory.ToString(), "", New String() {WindowsAPIKeys.Capacity.ToString()})
Dim collection As System.Management.ManagementObjectCollection = searcher.[Get]()
Dim em As System.Management.ManagementObjectCollection.ManagementObjectEnumerator = collection.GetEnumerator()
Dim capacity As Long = 0
Dim i As Integer =0
Dim all2 As String
For Each mo As object In moc
capacity = Long.Parse(mo.Properties(WindowsAPIKeys.Capacity.ToString()).Value.ToString())
i=i+1
For i2 As Integer = 1 To i
Dim ddr As String =""
If mo.Properties("SMBIOSMemoryType").Value.ToString() = 26 Then
ddr = "DDR4"
Else
ddr=mo.Properties("SMBIOSMemoryType").Value.ToString()
End If
msgbox("内存" & I & ": " & " "& capacity/1024/1024/1024 & "GB")
ALL2 = "内存" & I & ": " & mo.Properties("Manufacturer").Value.ToString() & " " & mo.Properties("speed").Value.ToString() & " 参数:" & capacity/1024/1024/1024 & "GB" & "|"
Next
Next
下面是搜集的报错信息
Not found
在 Microsoft.VisualBasic.CompilerServices.Symbols.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags)
在 Microsoft.VisualBasic.CompilerServices.NewLateBinding.CallMethod(Container BaseReference, String MethodName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure)
在 Microsoft.VisualBasic.CompilerServices.NewLateBinding.InternalLateIndexGet(Object Instance, Object[] Arguments, String[] ArgumentNames, Boolean ReportErrors, ResolutionFailure& Failure, Boolean[] CopyBack)
在 Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
在 Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
在 UserCode.AU0uMyq1TH4xAAWIK(ControlEventArgs e)