My previous message question was lost. I want to know how to disconnect the isp from dial up networking and then reconnect it at any time. Can this be done easily?
Who is Participating?
TorusConnect With a Mentor Commented:
Public Const RAS_MAXENTRYNAME = 256
Public Const RAS_MAXDEVICENAME = 128
Public Const SUCCESS = 0

Public Type RASCONN
    dwSize As Long
    hRasConn As Long
    szEntryName(RAS_MAXENTRYNAME) As Byte
    szDeviceType(RAS_MAXDEVICETYPE) As Byte
    szDeviceName(RAS_MAXDEVICENAME) As Byte
End Type

Public Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, lpcConnections As Long) As Long

Public Declare Function RasHangUp Lib "rasapi32.dll" Alias "RasHangUpA" _
            (ByVal hRasConn As Long) As Long

Public Function hangUp() As Boolean

Dim lpRasConn(255) As RASCONN
Dim lpcb As Long
Dim lpcConnections As Long
Dim lReturnCode As Long
Dim I as integer

lpRasConn(0).dwSize = LenB(lpRasConn(0))
lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
lpcConnections = 0
lReturnCode = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)
If lReturnCode = SUCESS then
    For I = 0 to lpcConnections - 1
           call RasHangUp(lpRasConn(0).hRasConn)
    next I
end if

end sub

Public Sub AutoDial()

     'If you are using win95/98, use the following code
     Call  Shell("rundll32.exe rnaui.dll,RnaDial " & "YourPhonebookEntryName", vbNormalFocus)
     SendKeys "{enter}", True
     'If you are using NT, use the following code instead
     Call  Shell("Rasphone -d " & "YourPhonebookEntryName", vbNormalFocus)
End Function

I'd bet the Crescent internet toolpack would have a solution for your needs.  They had everything including a RAS dialup control.  Search Yahoo or somebody for "Progress Crescent Internet Toolkit" and check out their stuff.  They do have some pretty cool stuff.  Less cool now that Microsoft include HTTP and some basics but still very new good ocx controls.
GoofyJoe99Author Commented:
Hey thanks torus!! And Informative too, thanks!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.