宽带VPN 换IP 问题
我用的是VB6.0 API连接宽带VPN与断开,但是用久了以后,发现会有断不开,要不就连不上,我在自己的电脑w7 64位上用,测试了几个都正常的,换另的电脑 w7 32位就会有问题了,请教是什么原因.或是有更好的VPN换IP的VB6代码提供下,已经研究了半个月,问题还是没有解决,请大神指点,以下是我自己用的换ip代码Option Explicit
Public Function AddConnection(strNewEntryName As String, strNewUsername As String, strNewPassword As String, Optional strNewDomain As String = "", Optional strNewPhoneNumber As String = "", Optional strNewCallbackNumber As String = "") As Long
Const APINULL = 0&
Dim lngRetCode As Long
Dim lngRetLstrcpy As Long
Dim lngRetHangUp As Long
Dim lpRasDialParams As RASDIALPARAMS95
Dim hRasConn As Long
On Error GoTo 10
lpRasDialParams.dwSize = 1052
lngRetLstrcpy = lstrcpy(lpRasDialParams.szEntryName(0), strNewEntryName)
lngRetLstrcpy = lstrcpy(lpRasDialParams.szPhoneNumber(0), strNewPhoneNumber)
lngRetLstrcpy = lstrcpy(lpRasDialParams.szCallbackNumber(0), strNewCallbackNumber)
lngRetLstrcpy = lstrcpy(lpRasDialParams.szUserName(0), strNewUsername)
lngRetLstrcpy = lstrcpy(lpRasDialParams.szPassword(0), strNewPassword)
lngRetLstrcpy = lstrcpy(lpRasDialParams.szDomain(0), strNewDomain)
Screen.MousePointer = vbHourglass
hRasConn = 0
lngRetCode = RasDial(ByVal APINULL, vbNullString, lpRasDialParams, APINULL, ByVal APINULL, hRasConn)
Screen.MousePointer = vbDefault
If lngRetCode Then
lngRetHangUp = RasHangUp(hRasConn)
End If
10
AddConnection = lngRetCode
End Function
Public Function HangUpAll() As Boolean '断开连接
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Long
Dim intLooper As Long
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
HangUpAll = False
Exit Function
End If
End If
HangUpAll = True
End Function