我的系统是WIN2K PRO,建立了一个VPN连接,连到公司.这样,我就可以在公司里面控制家里的机器了.
但是家里的网状态不是太好,有时候会断.我想写个程序,如果,断了的话,就自动重新拨号,连上VPN.也就是说用VB写个程序,去控制这个已存在的VPN连接.请问,怎么做?但是程序不知道怎么写.
大家有想法么?UP有分!
但是家里的网状态不是太好,有时候会断.我想写个程序,如果,断了的话,就自动重新拨号,连上VPN.也就是说用VB写个程序,去控制这个已存在的VPN连接.请问,怎么做?但是程序不知道怎么写.
大家有想法么?UP有分!
自动拔号属性就可以了
至于连接到INTERNET的拨号连接就不用程序管了。因为我是用路由上网.一开机就已经挂在网上了。谢谢大家的参与!
一定给分!
可以用SHELL来调用 PING +参数 >> xxx.TXT ,分析文本数据知道是否连通。
因为VPN连接后就等同于一个局域网。
判断不通后,怎么重拨呢?我就是这个不清楚.
定时判定链路断开
关键在于你与VPN的连接方式,使用虚拟拨号适配器进行连接??
Private Declare Function RasHangUp Lib "RasApi32.DLL" Alias "RasHangUpA" _
(ByVal hRasConn As Long) As Long
Private Declare Function RasEnumConnections _
Lib "RasApi32.DLL" Alias "RasEnumConnectionsA" _
(lprasconn As Any, lpcb As Long, lpcConnections As Long) As Long
Const RAS_RASCONNSIZE As Integer = 412
Const RAS95_MaxEntryName = 256
Const RAS95_MaxDeviceName = 128
Const RAS_MaxDeviceType = 16Private Type RASCONN95
'set dwsize to 412
dwSize As Long
hRasConn As Long
szEntryName(RAS95_MaxEntryName) As Byte
szDeviceType(RAS_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End TypePrivate Sub Command1_Click()
Dim X
X = Shell("rasdial gubins administrator gubin823119", 1)
End SubPrivate Sub Command2_Click()
Dim X
X = Shell("rasdial /disconnect", 0)
End SubPrivate Sub Command3_Click()
Dim res
res = Shell("rasphone.exe -d gubins", 1)
End SubPrivate Sub Command4_Click()
Dim res
res = Shell("rasphone.exe -h gubins", 0)
End SubPrivate Sub Command5_Click()
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Integer
Dim intLooper As Integer
ReDim lprasconn95(intArraySize) As RASCONN95
lprasconn95(0).dwSize = 412
lpcb = 256 * lprasconn95(0).dwSize
lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)
If lngRetCode = 0 Then
If lpcConnections > 0 Then
For intLooper = 0 To lpcConnections - 1
RasHangUp lprasconn95(intLooper).hRasConn
Next intLooper
Else
MsgBox "没有拨号网络连接!", vbInformation
End If
End If
End SubPrivate Sub Command6_Click()
Dim X
X = Shell("rundll32.exe rnaui.dll,RnaDial gubins", 1)
' DoEvents
' SendKeys "823119", True
' DoEvents
' SendKeys "{enter}", True
' DoEvents
End Sub
能说一下你的这几个BUTTON分别是做什么用的么?