Private Declare Function InternetDial Lib "wininet.dll" (ByVal hwndParent As Long, ByVal lpszConnectoid As String, ByVal dwFlags As Long, lpdwConnection As Long, ByVal dwReserved As Long) As Longdim iHandle as long
dim strDialName as string.....Call InternetDial(Me.hWnd, strDialName, INTERNET_AUTODIAL_FORCE_ONLINE Or INTERNET_AUTODIAL_FORCE_UNATTENDED, iHandle, 0)
If iHandle = 0 Then
msgbox "拨号不成功"
Exit Sub
End If
dim strDialName as string.....Call InternetDial(Me.hWnd, strDialName, INTERNET_AUTODIAL_FORCE_ONLINE Or INTERNET_AUTODIAL_FORCE_UNATTENDED, iHandle, 0)
If iHandle = 0 Then
msgbox "拨号不成功"
Exit Sub
End If
解决方案 »
- 如何删除无效字符串
- Visual Studio下编VB的编译问题
- VB默认的MS Sans Serif字体可以正常显示中文吗?
- 关于vb的datareport 请大家帮忙
- 哎,CoderHelper 终于可以正式发布了,也不知道大家喜不喜欢它,如果有兴趣你给看看把!
- 我用webbrowser控件打开一个网页,网页有个textarea控件,我的vb怎么得到该textarea控件中的text?
- 在vb中怎样调用这个?谁可以给出代码?
- 如何在Web中编写OCX控件,并打开Word、Excel等类型文件并进行编辑保存?
- 请教如何用VB实现图像的百叶窗效果?
- 谁能告诉我,如果用VC或VB做一个FLASH播放器。。
- 怎樣建立臨時的Recordset.(本人只有這么多分,請各位幫幫忙) 請進!
- 请问怎样得到列表框中被选中的文本?
Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
Const INTERNET_DIAL_UNATTENDED = &H8000
能给我发吗?
我的EMAIL:[email protected]
不胜感激!!!!!
' http://blackbeltvb.com
'
' Written by Matt Hart
' Copyright 1999 by Matt Hart
'
' This software is FREEWARE. You may use it as you see fit for
' your own projects but you may not re-sell the original or the
' source code. Do not copy this sample to a collection, such as
' a CD-ROM archive. You may link directly to the original sample
' using "http://blackbeltvb.com/dun.htm"
'
' No warranty express or implied, is given as to the use of this
' program. Use at your own risk.
'
' This sample shows how to fire up a DUN (Dial Up Networking)
' connection and see if it is online. There are a lot more
' API functions available in the RAS API. You can download an excellent
' sample program from Microsoft called VB32RAS.EXE at:
' http://support.microsoft.com/support/downloads/dp2109.asp
'
' Christian Gustavo Riva gave me the NT dial version. Thanks Christian!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 Type RASDEVINFO
dwSize As Long
szDeviceType(RAS_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Private Declare Function RasEnumDevices Lib "RasApi32.DLL" Alias "RasEnumDevicesA" (lprasdevinfo As Any, lpcb As Long, lpcConnections As Long) As Long
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 LongPrivate Sub Command1_Click()
Dim a$
a$ = "rundll rnaui.dll,RnaDial " & List1.List(List1.ListIndex)
' NT Version
' a$ = "rasphone.exe " & Chr$(34) & List1.List(List1.ListIndex) & Chr$(34)
Shell a$, vbNormalFocus
End SubPrivate 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 SubPrivate 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
On Local Error Resume Next
List1.ListIndex = 0
ReDim Rd(255) As RASDEVINFO
Rd(0).dwSize = Len(Rd(0)) + 3
s = 256 * Rd(0).dwSize
l = RasEnumDevices(Rd(0), s, ln)
For l = 0 To ln - 1
a$ = StrConv(Rd(l).szDeviceName(), vbUnicode)
List2.AddItem Left$(a$, InStr(a$, Chr$(0)) - 1)
Next
List2.ListIndex = 0
End Sub