H
hhd85
Unregistered / Unconfirmed
GUEST, unregistred user!
Dim IP,Name
Ip=Inputbox ("请输入IP"
Name=Inputbox ("请输入计算机名"
Ipx=Inputbox ("请输入内部网络号"
strComputer = "."
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2"
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"
strIPAddress = Array(IP)
strSubnetMask = Array("255.255.255.0"
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2"
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colComputers
ObjComputer.Rename(Name)
Next
Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration"
objNetworkSettings.SetIPXVirtualNetworkNumber(IPX)
/////////////////////////////////////////////////////////////////////////////
以上是vb代码,是用来修改 ipx的 内部网络号的,如何在delphi中实现,掉用。
Ip=Inputbox ("请输入IP"
Name=Inputbox ("请输入计算机名"
Ipx=Inputbox ("请输入内部网络号"
strComputer = "."
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2"
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"
strIPAddress = Array(IP)
strSubnetMask = Array("255.255.255.0"
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2"
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem"
For Each objComputer in colComputers
ObjComputer.Rename(Name)
Next
Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration"
objNetworkSettings.SetIPXVirtualNetworkNumber(IPX)
/////////////////////////////////////////////////////////////////////////////
以上是vb代码,是用来修改 ipx的 内部网络号的,如何在delphi中实现,掉用。