还有。如何程序实现设定IP地址。最好是VB的。
还有。如何程序实现设定IP地址。最好是VB的。 问题点数:20、回复次数:4Top
1 楼spark_li(晕忽忽(恶人谷:通讯连长))回复于 2004-05-03 15:48:14 得分 20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
设置ip的VBS脚本,稍微修改就能在VB中用吧。
Top
2 楼elby(elby)回复于 2004-05-03 20:23:42 得分 0
。
这在win98/xp下面都可以吗。
GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
这怎么出错了,是什么原因Top
3 楼elby(elby)回复于 2004-05-06 18:26:17 得分 0
还有其他人知道吗。Top
4 楼elby(elby)回复于 2004-05-06 18:29:11 得分 0
谢谢。OK了Top




