CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Posts
    9

    Create Dial-Up Network

    Hi ,Guru
    I'm using visual basic to create dial up networking .I have some problems:

    -how to set it to default connection.
    -How to check which network protocol my computer is using(TCP/IP,Netbios or IPX..).if not exist ,install it.
    -Install modem

    Could you please help me solve them



  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Create Dial-Up Network

    Check this sample. It might give you some clue

    Option Explicit


    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 Command1_Click()
    Dim a$
    a$ = "rundll rnaui.dll,RnaDial " & List1.List(List1.ListIndex)
    Shell a$, vbNormalFocus
    End Sub

    Private Sub Command2_Click()
    Dim s As Long, l As Long, ln As Long, a$, b$

    b$ = List1.List(List1.ListIndex)
    ReDim R(255) As RASCONN95

    R(0).dwSize = 412
    s = 256 * R(0).dwSize
    l = RasEnumConnections(R(0), s, ln)
    For l = 0 To ln - 1
    a$ = StrConv(R(l).szEntryName(), vbUnicode)
    a$ = Left$(a$, InStr(a$, Chr$(0)) - 1)
    If a$ = b$ Then MsgBox "Connected (or connecting)!": Exit Sub
    Next
    MsgBox "Not Connected!"
    End Sub

    Private Sub Form_Load()
    Dim s As Long, l As Long, ln As Long, a$
    ReDim R(255) As RASENTRYNAME95

    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)
    List1.AddItem Left$(a$, InStr(a$, Chr$(0)) - 1)
    Next
    List1.ListIndex = 0
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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