Dial Up Networking API needed 
Author Message
 Dial Up Networking API needed

Hello, All!

Is there in the Web any public resource showing how to call DUN API
functions from within MSA/VBA. I want a few simple calls to RAS server:
dialing to a connection by its name, checking if the line is up etc.

No Internet transfer functionality is needed. The VBA class module is
preferred.

Thanks for any reply.
--
Sincerely
   Dmitri Ivanov
   www.aha.ru/~divanov



Wed, 04 Dec 2002 03:00:00 GMT  
 Dial Up Networking API needed
i think i saw some code at www.mvps.org/access

anyway here some code for http://vbrussian.com mail list:

to establish connection:
Dim ret
ret = Shell("rundll32.exe rnaui.dll,RnaDial " _
 & "connection_name", 1)

to break connection:
Const RAS_MAXENTRYNAME = 256
Const RAS_MAXDEVICETYPE = 16
Const RAS_MAXDEVICENAME = 128
Const RAS_RASCONNSIZE = 412

Private Type RasEntryName
  dwSize As Long
  szEntryName(RAS_MAXENTRYNAME) As Byte
End Type

Private 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

Private Declare Function RasEnumConnections Lib "rasapi32.dll"   _  Alias
"RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, _
 lpcConnections As Long) As Long
Private Declare Function RasHangUp Lib "rasapi32.dll"  _
 Alias "RasHangUpA" (ByVal hRasConn As Long) As Long

Sub HangUp()
 Dim i As Long
 Dim lpRasConn(255) As RasConn
 Dim lpcb As Long
 Dim lpcConnections As Long
 Dim hRasConn As Long
 lpRasConn(0).dwSize = RAS_RASCONNSIZE
 lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
 lpcConnections = 0
 ReturnCode = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)

   If ReturnCode = ERROR_SUCCESS Then
      For i = 0 To lpcConnections - 1
 If Trim(CStr(lpRasConn(i).szEntryName)) = Trim(gstrispname) Then
    hRasConn = lpRasConn(i).hRasConn
    ReturnCode = RasHangUp(ByVal hRasConn)
 End If
      Next i
   End If
End Sub


Quote:
> Hello, All!

> Is there in the Web any public resource showing how to call DUN API
> functions from within MSA/VBA. I want a few simple calls to RAS server:
> dialing to a connection by its name, checking if the line is up etc.

> No Internet transfer functionality is needed. The VBA class module is
> preferred.

> Thanks for any reply.
> --
> Sincerely
>    Dmitri Ivanov
>    www.aha.ru/~divanov



Thu, 05 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. need API code to create a DUN connection under Dial up networking

2. need API code to create a DUN connection under Dial up networking

3. Dial Ups

4. Dial Ups

5. Default Dial Ups

6. Dial Ups

7. Dial Ups

8. Dial Ups

9. Programmatically change the number of dial ups

10. How to disconnect a dial up networking using an API function

11. WinInet API - InternetDial and Dial-Up Networking

12. Dial Up Networking API?

 

 
Powered by phpBB® Forum Software