InternetDial and InternetClose

Erdenemandal

Well-known member
Joined
Jul 5, 2004
Messages
63
Location
Deutschland
Hi, All

I am using InternetDial for my Program. Before starting I use InternetDial function to establish connection . Ok, It done and also before finishing my Program I want to close connection, but connection still exists.

This is my InternetDial function
Code:
Private Declare Function InternetDial Lib "Wininet.dll" ( _
                ByVal hwndParent As IntPtr, _
                ByVal lpszConnectoid As String, _
                ByVal dwFlags As Int32, _
                ByRef lpdwConnection As Int32, _
                ByVal dwReserved As Int32) _
        As Int32


Public Function Dial(ByVal ss As System.IntPtr)
                Dim d, conID, hconnect As Long

                d = InternetDial(ss, "My Connection", Me.INTERNET_DIAL_FORCE_PROMPT, conID, 0)
                Me.ConId = conID
                Me.MyconnectionId = d
                If (d = ERROR_SUCCESS) Then
                        Return True
                Else
                        Return False
                End If
        End Function

and Internetclose function

Code:
  Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer


Public Sub CloseInternet()
                If mconnectart = 1 Then
                        MsgBox("Closing internet conenction ")
                        InternetCloseHandle(Me.MyconnectionId)
                        InternetCloseHandle(Me.ConId)
                End If
        End Sub


Please help me

Thanks,
Erdenemandal
 
Back
Top