-1
我嘗試創建visual basic 2010程序,用於檢測連接了哪個連接及其ip地址。例如,如果我使用無線和有線連接,它將顯示媒體連接和它的IP地址。這從WMI代碼創建者使用visual basic 2010顯示連接狀態
Dim strComputer = "."
Dim Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery(_
"SELECT * FROM Win32_NetworkAdapterConfiguration",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_NetworkAdapterConfiguration instance"
Wscript.Echo "-----------------------------------"
If isNull(objItem.IPAddress) Then
Wscript.Echo "IPAddress: "
Else
Wscript.Echo "IPAddress: " & Join(objItem.IPAddress, ",")
End If
碼我把後來,我被錯誤信息
'colItems' is not declared. It may be inaccessible due to its protection level.
我是錯在做什麼?有人可以告訴我,如果這是錯誤的代碼或不?
'我是做錯誤的'也就是說VBScript中,不VB.NET。 – ElektroStudios