gson
October 23rd, 2001, 11:50 AM
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
Iouri
October 23rd, 2001, 12:33 PM
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
iouri@hotsheet.com