威尼斯赌博游戏

VB使用默认浏览器打开网页,VB打开网页方法

来源: www.zngps.com| 2017-09-23 05:52
代码1)用直接调用来打开网页
Private Sub Command1_Click()
    Dim strOpen
    strOpen = Shell("explorer.exe " & Text1, 1)
End Sub
 
Private Sub Form_Load()
    Text1 = "http://www.luyouqiwo.com"
End Sub
代码2)使用ShellExecute实现打开网页
Option Explicit
    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
    Dim strUrl As String
     
Private Sub OpenUrl(tUrl As String)
    ShellExecute Me.hwnd, "Open", tUrl, 0, 0, 0
End Sub
 
Private Sub Command1_Click()
    strUrl = Text1.Text
    OpenUrl (strUrl)
End Sub
 
Private Sub Form_Load()
    Text1 = "http://zhidao.baidu.com/"
End Sub

猜你喜欢
推荐
随机推荐
相关文档
月排行文档
Top
Baidu