如何断开及启用本地连接???

jiewhite 2003-11-13 11:51:41
同上!!!
...全文
357 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
goodname008 2003-12-11
  • 打赏
  • 举报
回复
/y 是不用确认。要是不加 /y 参数的话会提示确认。
实在抱歉,我这里没有环境,无法调试啊,你再试试吧。 :)
jiewhite 2003-12-11
  • 打赏
  • 举报
回复
我试了,所有服务中Network Connections最有可能了,可停止不了,刚停止马上自己就启动了!还有,/y是做什么用的?
goodname008 2003-12-11
  • 打赏
  • 举报
回复
我说的断开本地连接并不是运行Shell "net stop server /y",这只是举一个例子,应该是停止别的服务,我这里没有网络环境,所以无法调试。
你再试试停止别的某些服务。
jiewhite 2003-12-11
  • 打赏
  • 举报
回复
不成呀!用了Shell "net stop server /y",可本地连接并没断开呀!
希望大侠能在说详细些!谢谢!
chenyu5188 2003-12-06
  • 打赏
  • 举报
回复
同意楼上
goodname008 2003-12-06
  • 打赏
  • 举报
回复
开启就用:

Shell "net start server"
goodname008 2003-12-06
  • 打赏
  • 举报
回复
你是想屏蔽一些东西吧?

可以用Shell函数调用net命令来关闭某些服务,当然也可以断开网络连接。

Shell "net stop server /y"
mingtian2008 2003-12-06
  • 打赏
  • 举报
回复
up
踏平扶桑 2003-12-05
  • 打赏
  • 举报
回复
up
高手快来
jiewhite 2003-12-05
  • 打赏
  • 举报
回复

flc 2003-11-15
  • 打赏
  • 举报
回复
关注
学习ing
jiewhite 2003-11-14
  • 打赏
  • 举报
回复
To orcale:不是吧~~~你这是用于拨号的吧????我是在局域网中用,就是把“本地连接”断开和启用,哪用的上password之类的东东呀??
orcale 2003-11-14
  • 打赏
  • 举报
回复
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long
Const WN_SUCCESS = 0 ' The function was successful.
Const WN_NET_ERROR = 2 ' An error occurred on the network.
Const WN_BAD_PASSWORD = 6 ' The password was invalid.
Function AddConnection(MyShareName As String, MyPWD As String, UseLetter As String) As Integer
On Local Error GoTo AddConnection_Err
AddConnection = WNetAddConnection(MyShareName, MyPWD, UseLetter)
AddConnection_End:
Exit Function
AddConnection_Err:
AddConnection = Err
MsgBox Error$
Resume AddConnection_End
End Function
Function CancelConnection(DriveLetter As String, Force As Integer) As Integer
On Local Error GoTo CancelConnection_Err
CancelConnection = WNetCancelConnection(DriveLetter, Force)
CancelConnection_End:
Exit Function
CancelConnection_Err:
CancelConnection = Err
MsgBox Error$
Resume CancelConnection_End
End Function
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net

'to add a connection call by:
variable = AddConnection(<SharePath>, <Password>, <DriveLetter>)
'To cancel a connection type:
varible = CancelConnection(<SharePath, <Force>)
End Sub
馮強 2003-11-14
  • 打赏
  • 举报
回复
查API,有现成的。
jiewhite 2003-11-14
  • 打赏
  • 举报
回复
没人会吗?高手都去哪了???
3661512 2003-11-13
  • 打赏
  • 举报
回复
可以使用 WNetCancelConnection 或 WNetCancelConnection2 两个API,具体的查查MSDN
另外,你可以参考一下:
http://www.csdn.net/magazine/expert/Topic/0/45.shtm
jiewhite 2003-11-13
  • 打赏
  • 举报
回复
不成啊!做不出来呀!最好能给出源码!谢了!

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧