主题:VFP如何实现网卡的启用与禁用?
powerprefectsoftwate
[专家分:180] 发布于 2010-07-05 11:41:00
VFP如何实现网卡的启用与禁用?
回复列表 (共5个回复)
沙发
aaaa [专家分:0] 发布于 2010-07-09 21:05:00
大概是这样的
。
Clear
Public Array aconnections[1]
aconnections[1] = ''
Local singleconnection
i = 1
o = Createobject("Shell.Application")
ns=o.NameSpace (3)
For Each oItems In ns.Items
If oItems.Name ="网络连接" && Windows "Network Connections"
colNetwork = oItems.getfolder
If Vartype(colNetwork) = "O"
For Each colConn In colNetwork.Items
If Alen(aconnections) = 1 And Empty(aconnections[1])
Else
Dimension aconnections[ALEN(aconnections) + 1]
Endif
aconnections[I] = colConn.Name
i = i +1
Next
Endif
Exit
Endif
Next
For I = 1 To Alen(aconnections)
? aconnections[I]
If "无线网络连接" $ aconnections[I] && "Local"
Disconnect(aconnections[I])
Endif
Next
Function Connect(lcConnexion)
For Each colConn In colNetwork.Items
If colConn.Name = lcConnexion
singleconnection = colConn
Exit
Endif
Next
For Each clsVerb In singleconnection.Verbs
? "================"
? clsVerb.Name
If "C&onnect" = clsVerb.Name Or "启用(&A)" = clsVerb.Name
Try
singleconnection.InvokeVerb("连接(&O)")
Catch
singleconnection.InvokeVerb("启用(&A)")
Endtry
Endif
Next
Endfunc
Function DisConnect(lcConnexion)
? lcConnexion
? "-------------------"
For Each colConn In colNetwork.Items
If colConn.Name = lcConnexion
singleconnection = colConn
Exit
Endif
Next
For Each clsVerb In singleconnection.Verbs
? clsVerb.Name
If "停用(&B)" = clsVerb.Name
singleconnection.InvokeVerb("停用(&B)")
Endif
Next
Endfunc
RETURN
板凳
aaaa [专家分:0] 发布于 2010-07-09 21:07:00
或者用 Shell 命令也可以
停用:
netsh interface set interface "Wireless Network Connection" DISABLE
启用:
netsh interface set interface "Wireless Network Connection" ENABLE
3 楼
boyce [专家分:110] 发布于 2010-07-16 21:47:00
越看越觉得自己弱,差距好大
4 楼
powerprefectsoftwate [专家分:180] 发布于 2010-08-08 13:11:00
回复aaaa:
'大概是这样的'里面的命令只是显示了->
1.新建连接向导
2.网络连接向导
3.本地连接
这三个内容.
还有那个shell命令怎么用呢,指点一下吧,跪求!
5 楼
moke9 [专家分:30] 发布于 2010-09-02 09:40:00
你好.我是全职网赚工作者.
如果你有时间有电脑.
想在网络上创业.请联系我..
项目绝对真实.详情QQ空间资料
加盟请联系 QQ908889846
我来回复