程序中有一个标签控件,假设Caption属性为某公司的网址,此时我想直接在程序中通过单击这个标签就可以访问该网址?请问这个能实现吗?!

解决方案 »

  1.   

    Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Any, ByVal lParam As Long) As Long
    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
    ''*************************************
        ShellExecute Me.hwnd, "open", "http://hsren.myrice.com/", "", "", 1
      

  2.   

    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 Label1_Click()
    ShellExecute Me.hWnd, "open", "http://www.csdn.net", vbNullString, vbNullString, SW_SHOWEnd Sub
      

  3.   

    谢谢这大哥,但小弟实在太菜,从没用过API,照样复制后不能用,提示shellexecute没有声明?怎么办啊?!