江门市高考成绩:如何使用vb6.0编写能更改ip址址,网关等参数

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 01:11:48
如何使用vb6.0编写能更改ip址址,网关等参数

请问如何使用VB6.0编写能更改WINXP网卡IP地址,网关,DNS的代码?

思路很简单,但是用好了比较复杂,难点,查找本地网卡的名称(自己想办法),这里默认需要更改的接口是“本地连接"

----
intname = "本地连接"
ip = InputBox("ip")
submask = InputBox("submask")
gateway = InputBox("gateway")
dns = InputBox("dns")
Open App.Path & "\int-" & intname & ".config" For Output As #1
'/////生成脚本
Print #1, "pushd interface ip"
Print #1, "set address name = ""本地连接"" source = static addr = " & ip & " mask = " & submask
Print #1, "set address name = ""本地连接"" gateway = " & gateway & " gwmetric = 1"
Print #1, "set dns name = ""本地连接"" source = static addr = " & dns
'\\\\脚本生成,脚本内容不能更改
Close #1
Shell "netsh exec " & App.Path & "\int-" & intname & ".config", vbhide
-----
需要研究的问题
1-如何获得网卡的数量和名称
2-更改还需要一定时间,所以shell 最好加上WAIT功能
3-检查输入情况,错误排查

======
也不悬赏点分数,只适合2000(含)以后的系统