アダプター名を取得する方法
IPDLC 接続を設定するときに実行する必要があるタスクの 1 つは、接続先のアダプターの名前を取得することです。
アダプター名を取得するには
GetObject を使用して、ローカル コンピューター上の名前空間に接続します。
実行するメソッドとして GetAllNetworkAdapters を指定して ExecMethod を使用してアダプターの名前を取得します。
次の例は、システム上の最初のアダプターの名前を取得する方法を示しています。
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