다음을 통해 공유


어댑터 이름을 검색하는 방법

IPDLC 연결을 설정할 때 수행해야 하는 작업 중 하나는 연결 중인 어댑터의 이름을 검색하는 것입니다.

어댑터 이름을 검색하려면

  1. GetObject를 사용하여 로컬 컴퓨터의 네임스페이스에 연결합니다.

  2. 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