Ecco il codice per la CPU
Private Function CpuId() As String
Dim objProc As Object, objWMIService As Object
Dim strComputer As String
Dim colOSes As Object
Dim objOS As Object
Dim colCompSys As Object
Dim objCS As Object
Dim colProcessors As Object
Dim objProcessor As Object
Set objProc = GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'"
'If objProc.Architecture = 0 Then
' MsgBox "x86"
'ElseIf objProc.Architecture = 6 Then
' MsgBox "IPF"
'Else
' MsgBox "Unknown"
'End If
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2"
Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem"
For Each objOS In colOSes
' MsgBox "Computer Name: " & objOS.CSName
lblOS.Caption = " " & objOS.Caption 'Name
lblVers.Caption = " " & objOS.Version 'Version & build
lblBuild.Caption = " " & objOS.BuildNumber 'Build
' MsgBox " BuildType: " & objOS.BuildType
' MsgBox " OSProductSuite: " & objOS.OSProductsuite 'OS Product suite
' MsgBox " OSArchitecture: " & objOS.OSArchitecture
' MsgBox " WOWEnvironment: " & objOS.WOWEnvironment
' MsgBox " OSType: " & objOS.OSType
' MsgBox " OtherTypeDescription: (2003 Server R2 release only)" & objOS.OtherTypeDescription
lblServicePack.Caption = " " & objOS.ServicePackMajorVersion & "." & _
objOS.ServicePackMinorVersion
Next
Set colCompSys = objWMIService.ExecQuery("Select * from Win32_ComputerSystem"
For Each objCS In colCompSys
' MsgBox " NumberOfProcessors: " & objCS.NumberOfProcessors
' MsgBox " NumberOfLogicalProcessors: " & objCS.NumberOfLogicalProcessors
' MsgBox " PCSystemType: " & objCS.PCSystemType
Next
Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor"
For Each objProcessor In colProcessors
lblTipoProcessore.Caption = " " & objProcessor.Manufacturer
lblNomeCPU.Caption = " " & objProcessor.Name
' MsgBox " Description: " & objProcessor.Description
txtCPU.Text = objProcessor.ProcessorID
lblIDCpu.Caption = " " & objProcessor.ProcessorID
' MsgBox " Architecture: " & objProcessor.Architecture
' MsgBox " AddressWidth: " & objProcessor.AddressWidth
' MsgBox " NumberOfCores: " & objProcessor.NumberOfCores
' MsgBox " DataWidth: " & objProcessor.DataWidth
' MsgBox " Family: " & objProcessor.Family
' MsgBox " MaximumClockSpeed: " & objProcessor.MaxClockSpeed
Next
End Function