如何检索适配器名称
设置 IPDLC 连接时必须执行的任务之一是检索要连接的适配器的名称。
检索适配器名称
使用 GetObject 连接到本地计算机上的命名空间。
使用 ExecMethod 和 GetAllNetworkAdapters 作为要执行的方法检索适配器的名称。
以下示例演示如何检索系统上第一个适配器的名称:
Private Sub GetAdapterName()
Dim objService, outParam, objSD, MyArray, nArray
set objService = GetObject("winmgmts:root/microsofthis")
set outParam = objService.Execmethod("MsSna_LinkService_IPDLC",
"GetAllNetworkAdapters")
objSD = Join(outParam.Adapters, ",")
MyArray = Split(objSD, ",")
nArray = Ubound(MyArray)
if nArray < 0 then
strLocalAddress = ""
else
strLocalAddress = MyArray(0) 'default to first one
end if
End Sub