在窗口建立一个Label控件,Label控件的Caption="http:\\www.163.com",当鼠标点击Label控件时自动打开默认IE进行连接,请问如何连接?谢谢!

解决方案 »

  1.   

    lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPrivate Sub Form_Load()
        With Me.Label1
            .Caption = "http:\\www.163.com"
            .ForeColor = vbBlue
            .FontUnderline = True
            .AutoSize = True
        End With
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Me.MousePointer = 0
    End SubPrivate Sub Label1_Click()
        ShellExecute hwnd, "Open", Label1.Caption, "", "", 1
    End SubPrivate Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Me.MousePointer = 9
    End Sub这里只是把鼠标变成箭头,如果你要变成手,你就要找一张手形的ico代替
      

  2.   

    点击Label1的时候,用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 LongPrivate Sub Form_Load()
        With Me.Label1
            .Caption = "http:\\www.163.com"
            .ForeColor = vbBlue
            .FontUnderline = True
            .AutoSize = True
        End With
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Me.MousePointer = 0
    End SubPrivate Sub Label1_Click()
        ShellExecute hwnd, "Open", Label1.Caption, "", "", 1
    End SubPrivate Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Me.MousePointer = 9
    End Sub
      

  3.   

    >_<,用VC做个超链接才知道VB好强,简洁