[帮个小忙]如何用VB调用系统中的设置IP的对话框? 就是本地连接的“属性”,然后“TCP/IP”属性的那个设置IP的对话框,怎么调用?如果不能调用,怎么设置IP呢??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用wmi可以轻松设置IP当然,也可以netsh(cmd 命令) Function ModifyIP() strComputer = "." Set objWMIServiceGL = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colNetAdapters = objWMIServiceGL.ExecQuery("Select * from Win32_NetworkAdapterConfiguration") For Each objNetAdapter In colNetAdapters strIPAddress = Array("192.168.1.107") 'IP地址 strSubnetMask = Array("255.255.255.0") '子网掩码 errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) Exit For '只修改第一个网卡的设置 NextEnd Function以上能更改IP地址:以上代码段参考:http://www.qqread.com/vb/o415390.html Function ModifyIP() strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objSWbemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where Description='" & Combo1.Text & "'") For Each objNetAdapter In colNetAdapters sip = objNetAdapter.IPaddress(0) If Option1.Value = True Then 'DHCP is enabled objNetAdapter.EnableDHCP errDNS = objNetAdapter.SetDNSServerSearchOrder() Else strIPAddress = Array(Text1.Text) strSubnetMask = Array(Text2.Text) strGateway = Array(Text3.Text) strGatewaymetric = Array(1) StrDns = Array(Text4.Text, Text5.Text) errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric) errDNS = objNetAdapter.SetDNSServerSearchOrder(StrDns) 'Exit For '只修改第一个网卡的设置 End If Next End Function VB如何打包水晶报表? 求Setup Factory中文指南 怎么把一个控件放到另一个控件内? 如何知道用户点击了菜单的哪个item? #32770是什么控件啊,什么语言写的。 如何做到网络的断开与连接? 谁有水晶报表8.5提供下载 谢谢 刚开始学vb,问题很简单...... 我将去学delphi,大家给一点建议! 我看到有些程序用到自己定义的文件格式,还可以自己定义图标,怎么实现? UserControl 中的控件移动 糖果炸弹V1.9.0.153正式版,散分
当然,也可以netsh(cmd 命令)
Function ModifyIP()
strComputer = "."
Set objWMIServiceGL = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIServiceGL.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
For Each objNetAdapter In colNetAdapters strIPAddress = Array("192.168.1.107") 'IP地址
strSubnetMask = Array("255.255.255.0") '子网掩码
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Exit For '只修改第一个网卡的设置
Next
End Function以上能更改IP地址:以上代码段参考:
http://www.qqread.com/vb/o415390.html
Function ModifyIP() strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objSWbemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where Description='" & Combo1.Text & "'")
For Each objNetAdapter In colNetAdapters sip = objNetAdapter.IPaddress(0)
If Option1.Value = True Then 'DHCP is enabled
objNetAdapter.EnableDHCP
errDNS = objNetAdapter.SetDNSServerSearchOrder()
Else strIPAddress = Array(Text1.Text)
strSubnetMask = Array(Text2.Text)
strGateway = Array(Text3.Text)
strGatewaymetric = Array(1)
StrDns = Array(Text4.Text, Text5.Text)
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
errDNS = objNetAdapter.SetDNSServerSearchOrder(StrDns)
'Exit For '只修改第一个网卡的设置
End If Next End Function