首页上一页 1 下一页尾页 7 条记录 1/1页
获取CPU序列号的错误
发表在VB答疑区
2010-10-23
是否精华
是
否
版块置顶:
是
否
Dim mySerial As Long
Dim mylong As Long
Dim a As SWbemServices
Dim b As SWbemObjectSet
Dim C As SWbemObject
Dim d As SWbemPropertySet
Dim e As SWbemProperty
Set a = GetObject("winmgmts:")
Set b = a.InstancesOf("Win32_Processor")
For Each C In b
With C
If .Properties_.Count > 0 Then
Set d = .Properties_
For Each e In d
If e.Name = "ProcessorId" Then
mycpuid = e.Value
End If
Next
End If
End With
Next
VB范例宝典有获取CPU序列号的程序代码,为什么同样的代码在自己的电脑上运行不出错,在另外一台机上出现Invalid value of Null的错误,老师帮忙看一下呀,则可是你们书上原封不动的代码呀,郁闷中。
Dim mylong As Long
Dim a As SWbemServices
Dim b As SWbemObjectSet
Dim C As SWbemObject
Dim d As SWbemPropertySet
Dim e As SWbemProperty
Set a = GetObject("winmgmts:")
Set b = a.InstancesOf("Win32_Processor")
For Each C In b
With C
If .Properties_.Count > 0 Then
Set d = .Properties_
For Each e In d
If e.Name = "ProcessorId" Then
mycpuid = e.Value
End If
Next
End If
End With
Next
VB范例宝典有获取CPU序列号的程序代码,为什么同样的代码在自己的电脑上运行不出错,在另外一台机上出现Invalid value of Null的错误,老师帮忙看一下呀,则可是你们书上原封不动的代码呀,郁闷中。