试试~ 名称存放在 $arr 中#include <array.au3>
Local $arr
Local $aArray = GetAdapterProperty($arr)
_ArrayDisplay($aArray)
_ArrayDisplay($arr)
Func GetAdapterProperty(ByRef $arr)
Local $objShare
Local $objEveryColl
$objShare = ObjCreate("HNetCfg.HNetShare.1")
If Not IsObj($objShare) Then Return
$objEveryColl = $objShare.EnumEveryConnection
If Not IsObj($objEveryColl) Then Return
Local $objNetConn, $objShareCfg, $objNCProps, $str
Local $aProps[1][5] = [['网卡名称', 'Guid', '描述']]
Local $sGet2 = ''
For $objNetConn In $objEveryColl
$objShareCfg = $objShare.INetSharingConfigurationForINetConnection($objNetConn)
If IsObj($objShareCfg) Then
$objNCProps = $objShare.NetConnectionProps($objNetConn)
If IsObj($objNCProps) Then
ReDim $aProps[UBound($aProps) + 1][5]
$aProps[UBound($aProps) - 1][0] = $objNCProps.Name
$aProps[UBound($aProps) - 1][1] = $objNCProps.Guid
$aProps[UBound($aProps) - 1][2] = $objNCProps.DeviceName
If StringInStr($aProps[UBound($aProps) - 1][2], '环回适配器') Then
$sGet2 &= $aProps[UBound($aProps) - 1][0] & @LF
EndIf
$aProps[UBound($aProps) - 1][3] = $objNCProps.Status
$aProps[UBound($aProps) - 1][4] = $objNCProps.MediaType
EndIf
EndIf
Next
$arr = StringRegExp($sGet2, '\V+', 3)
Return $aProps
EndFunc ;==>GetAdapterProperty
|