如何在delphi中用,win的类。已有VB例子,望帮我一下。 ( 积分: 20 )

  • 主题发起人 主题发起人 hhd85
  • 开始时间 开始时间
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中实现,掉用。
 
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中实现,掉用。
 
咋没有人啊。帮帮我啊。各位高手。
 
WMI而已,你还是找份帮助自己看吧,说得那么玄乎。
 
后退
顶部