pease be with you
i want to make a dail up connection with vb ?
can you help ?
thanks
http://www.freewebs.com/egyprogramers/dail_up.bmp
Printable View
pease be with you
i want to make a dail up connection with vb ?
can you help ?
thanks
http://www.freewebs.com/egyprogramers/dail_up.bmp
Put this into a class module in your project
VB Code:
Option Explicit Private Type RASDIALPARAMS dwSize As Long szEntryName(256) As Byte szPhoneNumber(128) As Byte szCallbackNumber(128) As Byte szUserName(256) As Byte szPassword(256) As Byte szDomain(15) As Byte End Type Private Declare Function RasDialA Lib "RASAPI32.DLL" (ByVal lpRasDialExtensions As Long, ByVal lpszPhoneBook As Long, lpRasDialParams As RASDIALPARAMS, ByVal dwNotifierType As Long, ByVal lpvNotifier As Long, lphRasConn As Long) As Long Private Declare Function RasHangUpA Lib "RASAPI32.DLL" (ByVal hRasConn As Long) As Long Public Function RasDial(pEntryName As String, pUsername As String, pPassword As String, pDomain As String, RasConnection As Long) As Long Dim rdp As RASDIALPARAMS Dim c As Integer rdp.dwSize = 1052 For c = 0 To (Len(pUsername) - 1) rdp.szUserName(c) = Asc(Mid(pUsername, c + 1, 1)) Next For c = 0 To (Len(pPassword) - 1) rdp.szPassword(c) = Asc(Mid(pPassword, c + 1, 1)) Next For c = 0 To (Len(pEntryName) - 1) rdp.szEntryName(c) = Asc(Mid(pEntryName, c + 1, 1)) Next For c = 0 To (Len(pDomain) - 1) rdp.szDomain(c) = Asc(Mid(pDomain, c + 1, 1)) Next c 'RasDialA will place return code in Connect and return to calling routine RasDial = RasDialA(0&, 0&, rdp, 0&, 0&, RasConnection) End Function Public Function RasHangUp(RasConnection As Long) As Long RasHangUp = RasHangUpA(RasConnection) End Function In you project do this: Private Sub ConnectDun() ' DunName is the name of your phone book entry to use Username = "JAMES" PassWord = "BOND" Domain = "MI5" lReturnCode = dun.RasDial(DunName, UserName,PassWord, "DOMAIN", gRASConn) If lReturnCode <> 0 Then lReturnCode = dun.RasHangUp(gRASConn) ModemConnected = 0 MsgBox "Error connecting to " & DunName & " " & lReturnCode Exit Sub End If End Sub Private Sub DisconnectDun() lReturnCode = dun.RasHangUp(gRASConn) End Sub
dear : gilly
thanks for reply .
but i can't work with this code !!
there is an error in this line :
i don't know why ??Code:lReturnCode = dun.RasDial(DunName, UserName, PassWord, "Domain", gRASConn)
and i attach the project can you edit it if there is a error in itCode:424
object required
thanks
pease be with you
no one !!??
The code posted by Gilly won't actually Create a dial-up connection, it will only open/close one.
I've attached a project in which I've cleaned up and adapted into a class,
some code originally posted by reinhardt007 on Experts Exchange.
This class will allow you to create a new Dial-Up connection. (Tested in Windows 2000 Pro. environment only.)
Works on my XP home also. Great code! ;)
pease be with you
when i see this name "Aaron Young" i know that this problem will resolve .
thanks Aaron for you help and i will test it in " win 2000 " ( i know it will
work ) .
when i test it in "win98" this message will shown .
Failed to Create Dial-Up Connection the parameter is incorrect .
and i think if we will make this class work on win98 or other
we must to change this two functions :
1- SetEntryProperties
2- GetEntryProperties
any one will find that " win2000 " & " win nt" declaraed in it.
therefor to make this project work on win98 we want to declaraed it
and i don't know how ?
in the last thanks for ' Aaron Young ' & ' Gilly ' & ' manavo11 '
for replies
thanks .
pease be with you
no one will complete !!??