又一个 Active部件不能创建对象
程序代码:
Private Sub Command1_Click() Dim aa As String Dim strLocalIP As String Dim winIP As Object Dim cpuSet As SWbemObjectSet Dim cpu As SWbemObject Set winIP = CreateObject("MSWinsock.Winsock") strLocalIP = winIP.localip aa = strLocalIP Set cpuSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_Processor") For Each cpu In cpuSet aa = aa & cpu.ProcessorId 'aa = aa & "A" & cpu.ProcessorId Open App.Path & "\duquip2.txt" For Output As #1 'Output Append Write #1, cpu.ProcessorId Close #1 Next Open App.Path & "\1.txt" For Output As #1 'Output Append Write #1, aa Close #1 MsgBox "生成完毕" End Sub