'添加 Command1 Private Sub Command1_Click() MsgBox "CPU系列号:" & GetCpu End Sub Public Function GetCpu() As String On Error Resume Next Dim TmpCode$ Dim objWMIService As Object, objItem As Object, colItems As Object Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor", , 48) For Each objItem In colItems TmpCode = objItem.ProcessorId Next GetCpu = TmpCode End Function