CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Location
    Baltimore , MD
    Posts
    10

    Create DUN and Dialer

    I am new to VB and want to create a Dialer for an ISP . This program should create a DUN entry on user's computer and connect to the DUN entry .
    I have seen wininet sample . They show you how to connect using an already existing DUN entry but donot tell how to create one. Is there a sample out there on how to create a DUN entry ?
    Thanks
    Atif


  2. #2
    Join Date
    May 1999
    Posts
    27

    Re: Create DUN and Dialer

    Look here:
    http://home.iprimus.com.au/billmcc/P...VB/Default.htm

    Or
    www.catalyst.com

    Or

    Public Sub CreateDunWin9x()

    Dim Win
    Win = Shell("rundll32.exe rnaui.dll,RnaWizard", 1)

    End Sub

    Public Sub CreateDunWinNT2000()

    Dim NT
    NT = Shell("rasphone.exe -a", 1)

    End Sub

    -Dj4


  3. #3
    Join Date
    Aug 2001
    Location
    Minneapolis, MN, USA
    Posts
    150

    Re: Create DUN and Dialer

    Here's some code that creates a dial-up. I am having trouble with dialing on 2000, but I am currently looking into it. Use the link dj4 gave you (http://home.iprimus.com.au/billmcc/P...n/contents.htm). Good luck.


    '#########################################
    'MODULE CODE
    '#########################################
    Option Explicit
    Public Type RASIPADDR
    a As Byte
    b As Byte
    c As Byte
    d As Byte
    End Type

    Public Enum RasEntryOptions
    RASEO_UseCountryAndAreaCodes = &H1
    RASEO_SpecificIpAddr = &H2
    RASEO_SpecificNameServers = &H4
    RASEO_IpHeaderCompression = &H8
    RASEO_RemoteDefaultGateway = &H10
    RASEO_DisableLcpExtensions = &H20
    RASEO_TerminalBeforeDial = &H40
    RASEO_TerminalAfterDial = &H80
    RASEO_ModemLights = &H100
    RASEO_SwCompression = &H200
    RASEO_RequireEncryptedPw = &H400
    RASEO_RequireMsEncryptedPw = &H800
    RASEO_RequireDataEncryption = &H1000
    RASEO_NetworkLogon = &H2000
    RASEO_UseLogonCredentials = &H4000
    RASEO_PromoteAlternates = &H8000
    RASEO_SecureLocalFiles = &H10000
    RASEO_RequireEAP = &H20000
    RASEO_RequirePAP = &H40000
    RASEO_RequireSPAP = &H80000
    RASEO_Custom = &H100000
    RASEO_PreviewPhoneNumber = &H200000
    RASEO_SharedPhoneNumbers = &H800000
    RASEO_PreviewUserPw = &H1000000
    RASEO_PreviewDomain = &H2000000
    RASEO_ShowDialingProgress = &H4000000
    RASEO_RequireCHAP = &H8000000
    RASEO_RequireMsCHAP = &H10000000
    RASEO_RequireMsCHAP2 = &H20000000
    RASEO_RequireW95MSCHAP = &H40000000
    RASEO_CustomScript = &H80000000
    End Enum

    Public Enum RASNetProtocols
    RASNP_NetBEUI = &H1
    RASNP_Ipx = &H2
    RASNP_Ip = &H4
    End Enum

    Public Enum RasFramingProtocols
    RASFP_Ppp = &H1
    RASFP_Slip = &H2
    RASFP_Ras = &H4
    End Enum

    Public Type VBRasEntry
    options As RasEntryOptions
    CountryID As Long
    CountryCode As Long
    areaCode As String
    LocalPhoneNumber As String
    AlternateNumbers As String
    ipAddr As RASIPADDR
    ipAddrDns As RASIPADDR
    ipAddrDnsAlt As RASIPADDR
    ipAddrWins As RASIPADDR
    ipAddrWinsAlt As RASIPADDR
    FrameSize As Long
    fNetProtocols As RASNetProtocols
    FramingProtocol As RasFramingProtocols
    ScriptName As String
    AutodialDll As String
    AutodialFunc As String
    DeviceType As String
    DeviceName As String
    X25PadType As String
    X25Address As String
    X25Facilities As String
    X25UserData As String
    Channels As Long
    NT4En_SubEntries As Long
    NT4En_DialMode As Long
    NT4En_DialExtraPercent As Long
    NT4En_DialExtraSampleSeconds As Long
    NT4En_HangUpExtraPercent As Long
    NT4En_HangUpExtraSampleSeconds As Long
    NT4En_IdleDisconnectSeconds As Long
    Win2000_Type As Long
    Win2000_EncryptionType As Long
    Win2000_CustomAuthKey As Long
    Win2000_guidId(0 To 15) As Byte
    Win2000_CustomDialDll As String
    Win2000_VpnStrategy As Long
    End Type

    '#########################################
    ' FORM CODE
    '#########################################
    Private Sub CreateDUN()
    ' Creates a dial-up connection and names it DUN
    Dim typDUN As VBRasEntry

    typDUN.areaCode = "900"
    typDUN.AutodialFunc = 0
    typDUN.CountryCode = "1"
    typDUN.CountryID = "1"

    'This code is not needed on 2000. It find the default dial-up device
    typDUN.DeviceName = me.cboDevices.Text

    typDUN.DeviceType = "modem"
    typDUN.fNetProtocols = RASNP_Ip + RASNP_Ipx + RASNP_NetBEUI
    typDUN.FramingProtocol = RASFP_Ppp
    typDUN.options = RASEO_SwCompression + RASEO_IpHeaderCompression + RASEO_RemoteDefaultGateway _
    + RASEO_UseCountryAndAreaCodes + RASEO_NetworkLogon

    typDUN.LocalPhoneNumber = "000 0000"

    Dim rtn As Long
    rtn = VBRasSetEntryProperties("DUN", typDUN)
    If rtn <> 0 Then
    MsgBox VBRASErrorHandler(rtn)
    Else
    MsgBox "DUN connection created.", vbOKOnly, "Complete"
    End If

    End Sub


    Private Sub Form_Load()
    'list the devices here
    End Sub


    No L c
    VB Developer

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

Featured