|
#include <GUIConstants.au3>
#include <GuiIPAddress.au3>
;获取网卡相关的信息
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For $objItem In $colItems
;获取网关
$LocalGateway = $objItem.DefaultIPGateway(0)
;获取计算机名
$LoaclHostName =$objItem.DNSHostName
;获取IP地址
$LocalIP=$objItem.IPAddress(0)
;获取DNS首选
$LocalDns1 = $objItem.DNSServerSearchOrder(0)
;获取DNS备用
$LocalDns2 = $objItem.DNSServerSearchOrder(1)
;获取子掩网码
$LocalSubnetmask = $objItem.IPSubnet(0)
;获取网卡名称
$b = $objItem.Description
;获取MAC地址
$MAC1 = $objItem.MACAddress
Next
Local $index = 3
$Form1 = GUICreate("IP地址修改器", 394, 366, 301, 157)
F()
$Tab1 = GUICtrlCreateTab(8, 8, 377, 313)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("IP修改")
$Label1 = GUICtrlCreateLabel("如果网络支持此功能,刚可以获取自动指派的 IP 设置。否则,", 24, 40, 332, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("您需要从网络系统管理员处获得适当的 IP 设置。", 24, 64, 260, 17)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("设置下面的IP地址(S):", 24, 88, 345, 113)
$Label3 = GUICtrlCreateLabel("IP 地址:", 48, 112, 72, 17)
$Label4 = GUICtrlCreateLabel("子网掩码:", 48, 144, 64, 17)
$Label5 = GUICtrlCreateLabel("默认风关:", 48, 176, 64, 17)
$Input1 = _GUICtrlIpAddressCreate ($Form1, 176, 112, 153, 21)
_GUICtrlIpAddressSet ($Input1,$LocalIP)
$Input2 = _GUICtrlIpAddressCreate ($Form1, 176, 140, 153, 21)
_GUICtrlIpAddressSet ($Input2, $LocalSubnetmask)
$Input3 = _GUICtrlIpAddressCreate ($Form1, 176, 168, 153, 21)
_GUICtrlIpAddressSet ($Input3, $LocalGateway)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("设置下面的 DNS 服务器地址(E):", 24, 208, 345, 97)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("首选 DNS 服务器:", 48, 240, 105, 17)
$Label7 = GUICtrlCreateLabel("备用 DNS 服务器:", 48, 272, 105, 17)
$Input4 = _GUICtrlIpAddressCreate ($Form1, 176, 232, 153, 21)
_GUICtrlIpAddressSet ($Input4,$LocalDns1)
$Input5 = _GUICtrlIpAddressCreate ($Form1, 176, 264, 153, 21)
_GUICtrlIpAddressSet ($Input5,$LocalDns2)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("确定", 128, 328, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 216, 328, 75, 25, 0)
$Button3 = GUICtrlCreateButton("应用", 304, 328, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_SetIpEditState(0)
_MQ($Input1,$Input2,$Input3,$Input4,$Input5)
_SetIpEditState(1)
Exit
Case $Button3
_SetIpEditState(0)
_MQ($Input1,$Input2,$Input3,$Input4,$Input5)
_SetIpEditState(1)
MsgBox(64,"提示","IP相关修改完成!")
Case $Button2
Exit
EndSwitch
WEnd
Func _MQ($IP,$mas,$GW,$Dns1,$Dns2)
$ipAdd = _GUICtrlIpAddressGet($IP)
$Mask = _GUICtrlIpAddressGet($mas)
$Gateway = _GUICtrlIpAddressGet($GW)
Dim $LocalIPAddress[1] = [$ipAdd]
Dim $strSubnetMask[1] = [$Mask]
Dim $strGateway[1] = [$Gateway]
Dim $strGatewayMetric[1] = [1]
Dim $strdns[2]
$strdns[0]= _GUICtrlIpAddressGet($Dns1)
$strdns[1]= _GUICtrlIpAddressGet($Dns2)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
If IsObj($colItems) Then
For $objNetAdapter in $colItems
$objNetAdapter.EnableStatic($LocalIPAddress,$strSubnetMask)
$objNetAdapter.SetGateways($strGateway)
$objNetAdapter.SetDNSServerSearchOrder($strdns)
Next
Endif
EndFunc
Func _SetIpEditState($s=1)
For $i=2 To 21
If $s=0 Then
ControlDisable("","","Edit" & $i)
Else
ControlEnable("","","Edit"& $i)
EndIf
Next
EndFunc |
Windows, 程序, 电脑, 服务器, 破解, 软件, 系统, Vista, 软件, 系统, 破解, 电脑, 软件, Windows, 程序, 电脑, 破解, 软件, 网络, 系统, 软件, 系统, Ghost, 计算机, 破解, 软件, 系统, 电脑, 服务器, 密码, 破解, 软件, 网吧, 网络, 系统,
|