关于或许网卡上子网掩码信息的问题
我想获取电脑网卡的信息代码如下:GUICtrlSetData($bjxx_pc_nae, "计算机名称 : " & @ComputerName)
GUICtrlSetData($bjxx_ip, "本机IP : " & @IPAddress1)
GUICtrlSetData($bjxx_ym, "子网掩码 : ")
GUICtrlSetData($bjxx_wg, "默 认 网 关 :" & _Gateway())
Func _Gateway()
Dim $IPGateway
Dim $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
Dim $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
For $objItem In $colItems
$IPGateway = $objItem.DefaultIPGateway(0)
If StringInStr($IPGateway, ".") > 0 Then ExitLoop
Next
Return StringRegExpReplace($IPGateway, '(\d+\.){12}', '')
EndFunc ;==>_Gateway
GUICtrlSetData($bjxx_mac_address, "本 机 MAC : " & _API_Get_NetworkAdapterMAC(@IPAddress1))
GUICtrlSetData($bjxx_pub_ip, "公网IP地址: " & _qqip())
Func _qqip()
Local $source = _INetGetSource("http://ip.qq.com")
Local $aIP = StringRegExp($source, '您当前的IP为.*?(\d[\d.]+)', 3, 1)
If Not @error Then
Return $aIP
Else
Return 0
EndIf
EndFunc ;==>_qqip
GUICtrlSetData($bjxx_info_get_time, "当前时间:" & @YEAR & "-" & @MON & "-" & @MDAY & "" & @HOUR & ":" & @MIN & ":" & @SEC)
有哪位大神 可以指导下 那个子网掩码 怎么写哦,跪谢 命令行cmd/k ipconfig/all>1.txt 然后提取文本就可以了 直接读取注册表,结果应该不会错的,不过需要枚举所有网卡。HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces\ 回复 1# sky8512
Local $net
_Gateway()
MsgBox(64, "结果", $net)
Func _Gateway()
Dim $IPGateway
Dim $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
Dim $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
For $objItem In $colItems
$IPGateway = $objItem.DefaultIPGateway(0)
$net = "子网掩码:" & $objItem.IPSubnet(0) & "”" & @CRLF
Next
Return StringRegExpReplace($IPGateway, '(\d+\.){12}', '')
EndFunc ;==>_Gateway
GUICtrlSetData($bjxx_ym, $net) 回复 4# chzj589
学习学习。 直接读取注册表,结果应该不会错的,不过需要枚举所有网卡。
页:
[1]