InternetDial无法调用

橘子皮... 2018-11-02 02:27:53

Public Class RAS
<DllImport("Rasapi32.dll", EntryPoint:="RasEnumConnectionsA", SetLastError:=True)> _
Friend Shared Function RasEnumConnections(ByRef lprasconn As RASCONN, ByRef lpcb As Integer, ByRef lpcConnections As Integer) As Integer
End Function

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Friend Shared Function RasGetConnectionStatistics(ByVal hRasConn As IntPtr, <[In](), Out()> ByVal lpStatistics As RasStats) As UInteger
End Function

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function RasHangUp(ByVal hrasconn As IntPtr) As UInteger
End Function

<DllImport("rasapi32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function RasEnumEntries(ByVal reserved As String, ByVal lpszPhonebook As String, <[In](), Out()> ByVal lprasentryname As RasEntryName(), ByRef lpcb As Integer, ByRef lpcEntries As Integer) As UInteger
End Function

<DllImport("wininet.dll", CharSet:=CharSet.Auto)> _
Public Shared Function InternetDial(ByVal hwnd As IntPtr, <[In]()> ByVal lpszConnectoid As String, ByVal dwFlags As UInteger, ByRef lpdwConnection As Integer, ByVal dwReserved As UInteger) As Integer
End Function

Public Sub New()
End Sub
End Class

Public Function Connect(ByVal Connection As String) As Boolean
Dim temp As Integer = 0, INTERNET_AUTO_DIAL_UNATTENDED As UInteger = 2
Dim retVal As Integer = RAS.InternetDial(IntPtr.Zero, Connection, INTERNET_AUTO_DIAL_UNATTENDED, temp, 0)
If retVal = 0 Then Return True Else Return False
End Function


InternetDial这个api在win7里不知道为什么总是没法调出窗口连接网络拨号,在xp里可以,百度也搜不到相关信息。。。
...全文
70 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
橘子皮... 2018-11-03
  • 打赏
  • 举报
回复
引用 1 楼 itleon 的回复:
win7是不是精简版啊?有没装网络拨号模块?
你测试了可以??
良朋 2018-11-02
  • 打赏
  • 举报
回复
win7是不是精简版啊?有没装网络拨号模块?

16,555

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧