Results 1 to 8 of 8

Thread: how i can creat a new dail-up connection ??

  1. #1

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    how i can creat a new dail-up connection ??

    pease be with you

    i want to make a dail up connection with vb ?

    can you help ?


    thanks

    In the name of allah , the beneficent , the merciful

    Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  2. #2
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Put this into a class module in your project
    VB Code:
    1. Option Explicit
    2.  
    3. Private Type RASDIALPARAMS
    4.    dwSize As Long
    5.    szEntryName(256) As Byte
    6.    szPhoneNumber(128) As Byte
    7.    szCallbackNumber(128) As Byte
    8.    szUserName(256) As Byte
    9.    szPassword(256) As Byte
    10.    szDomain(15) As Byte
    11. End Type
    12.  
    13. Private Declare Function RasDialA Lib "RASAPI32.DLL" (ByVal
    14. lpRasDialExtensions As Long, ByVal lpszPhoneBook As Long, lpRasDialParams As
    15. RASDIALPARAMS, ByVal dwNotifierType As Long, ByVal lpvNotifier As Long,
    16. lphRasConn As Long) As Long
    17. Private Declare Function RasHangUpA Lib "RASAPI32.DLL" (ByVal hRasConn As
    18. Long) As Long
    19.  
    20.  
    21. Public Function RasDial(pEntryName As String, pUsername As String, pPassword
    22. As String, pDomain As String, RasConnection As Long) As Long
    23.    Dim rdp As RASDIALPARAMS
    24.    Dim c As Integer
    25.  
    26.    rdp.dwSize = 1052
    27.  
    28.    For c = 0 To (Len(pUsername) - 1)
    29.       rdp.szUserName(c) = Asc(Mid(pUsername, c + 1, 1))
    30.    Next
    31.    For c = 0 To (Len(pPassword) - 1)
    32.       rdp.szPassword(c) = Asc(Mid(pPassword, c + 1, 1))
    33.    Next
    34.    For c = 0 To (Len(pEntryName) - 1)
    35.       rdp.szEntryName(c) = Asc(Mid(pEntryName, c + 1, 1))
    36.    Next
    37.  
    38.    For c = 0 To (Len(pDomain) - 1)
    39.       rdp.szDomain(c) = Asc(Mid(pDomain, c + 1, 1))
    40.    Next c
    41.  
    42.    'RasDialA will place return code in Connect and return to calling routine
    43.    RasDial = RasDialA(0&, 0&, rdp, 0&, 0&, RasConnection)
    44.  
    45. End Function
    46.  
    47. Public Function RasHangUp(RasConnection As Long) As Long
    48.    RasHangUp = RasHangUpA(RasConnection)
    49. End Function
    50.  
    51. In you project do this:
    52. Private Sub ConnectDun()
    53.         ' DunName is the name of your phone book entry to use
    54.         Username = "JAMES"
    55.         PassWord = "BOND"
    56.         Domain = "MI5"
    57.         lReturnCode = dun.RasDial(DunName, UserName,PassWord, "DOMAIN",
    58. gRASConn)
    59.         If lReturnCode <> 0 Then
    60.             lReturnCode = dun.RasHangUp(gRASConn)
    61.             ModemConnected = 0
    62.             MsgBox "Error connecting to " & DunName & " " & lReturnCode
    63.             Exit Sub
    64.         End If
    65. End Sub
    66.  
    67. Private Sub DisconnectDun()
    68.         lReturnCode = dun.RasHangUp(gRASConn)
    69. End Sub
    Gilly

  3. #3

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    thanks so much

    dear : gilly

    thanks for reply .

    but i can't work with this code !!

    there is an error in this line :

    Code:
           lReturnCode = dun.RasDial(DunName, UserName, PassWord, "Domain", gRASConn)
    i don't know why ??

    Code:
    424
    object required
    and i attach the project can you edit it if there is a error in it

    thanks
    Attached Files Attached Files
    In the name of allah , the beneficent , the merciful

    Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  4. #4

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    hi

    pease be with you

    no one !!??
    In the name of allah , the beneficent , the merciful

    Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  5. #5
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    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.)
    Attached Files Attached Files

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Works on my XP home also. Great code!
    Last edited by manavo11; Aug 18th, 2003 at 06:03 PM.


    Has someone helped you? Then you can Rate their helpful post.

  7. #7

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312
    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 .
    In the name of allah , the beneficent , the merciful

    Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  8. #8

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    hi

    pease be with you

    no one will complete !!??
    In the name of allah , the beneficent , the merciful

    Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width