Link to home
Start Free TrialLog in
Avatar of foxhound
foxhound

asked on

how to dial a connection?

i know that i can make the dialind screen appear with this code
Shell "rundll rnaui.dll,RnaDial NAME", vbNormalFocus
but how do u actualyl start it dialing? it shoudln't be hard i think. thanks
Avatar of waty
waty
Flag of Belgium image

Private Sub cmdConnect_Click()
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Waty Thierry
   ' * Web Site         : www.geocities.com/ResearchTriangle/6311/
   ' * E-Mail           : waty.thierry@usa.net
   ' * Date             : 18/10/1999
   ' * Time             : 20:31
   ' * Module Name      : frmConnectInternet
   ' * Module Filename  : Connect.frm
   ' * Procedure Name   : cmdConnect_Click
   ' * Parameters       :
   ' **********************************************************************
   ' * Comments         :
   ' *
   ' *
   ' **********************************************************************

   Dim a$
   a$ = "rundll rnaui.dll,RnaDial " & lstConnection.List(lstConnection.ListIndex)
   Shell a$, vbNormalFocus
   
End Sub
To find all the available connections :

Private Const RAS_MaxDeviceType = 16
Private Const RAS95_MaxDeviceName = 128
Private Const RAS95_MaxEntryName = 256
Private 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 Type
Private Type RASENTRYNAME95
   'set dwsize to 264
   dwSize As Long
   szEntryName(RAS95_MaxEntryName) 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 RasEnumEntries Lib "RasApi32.DLL" Alias "RasEnumEntriesA" (ByVal reserved As String, ByVal lpszPhonebook As String, lprasentryname As Any, lpcb As Long, lpcEntries As Long) As Long


Private Sub Form_Load()
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Waty Thierry
   ' * Web Site         : www.geocities.com/ResearchTriangle/6311/
   ' * E-Mail           : waty.thierry@usa.net
   ' * Date             : 18/10/1999
   ' * Time             : 20:31
   ' * Module Name      : frmConnectInternet
   ' * Module Filename  : Connect.frm
   ' * Procedure Name   : Form_Load
   ' * Parameters       :
   ' **********************************************************************
   ' * Comments         :
   ' *
   ' *
   ' **********************************************************************

   Dim s As Long, l As Long, ln As Long, a$
   ReDim r(255) As RASENTRYNAME95

   m_gradient.GradientForm Me
   
   r(0).dwSize = 264
   s = 256 * r(0).dwSize
   l = RasEnumEntries(vbNullString, vbNullString, r(0), s, ln)
   For l = 0 To ln - 1
      a$ = StrConv(r(l).szEntryName(), vbUnicode)
      lstConnection.AddItem Left$(a$, InStr(a$, Chr$(0)) - 1)
   Next
   lstConnection.ListIndex = 0
   
End Sub
Avatar of foxhound
foxhound

ASKER

i said the i have the code Shell "rundll rnaui.dll,RnaDial NAME", vbNormalFocus in my orginal question but that only display the 'connect' screen, doesnt' actually start dialing. i it possible? thanks
You could simply call:
SendKeys "{ENTER}"
after you call the Shell command..
That would press the enter key, causing the "Connect" button to be pressed.
nope, i'll tried that, the enter goes to the form rather than the 'connect' screen, even after i used vbnormalfocus
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points! Glad I could help!


Cheers!