VB用默认浏览器打开网页

运用以下代码可以用默认的浏览器打开网页,而不是固定只使用IE。
在窗体中加入以下代码:
Private Declare Function ShellExecute Lib “shell32.dll” Alias “ShellExecuteA” (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub OpenUrl(tUrl As String)
ShellExecute Me.hwnd, “Open”, tUrl, 0, 0, 0
End Sub

用法:
OpenUrl “http://ilovetile.com”



发表评论

电子邮件地址不会被公开。 必填项已用*标注