VB中 用label输入拉一行汉字 然后我想当别人点击该行字时 如何打开指定网站?

来源:百度知道 编辑:UC知道 时间:2024/09/22 03:54:53
RT 谢谢

private sub label1_click()
shell "explorer.exe ""http://www.baidu.com"" "
end sub

private sub form_load()
label1.caption = "点我打开百度!"
end sub

Private Label1_Click()
Shell "Explorer.exe "+(URL As String)
End Sub

方法一:默认浏览器打开(推荐)
'先声明如下的API函数:
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 Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2

'调用的时候就这样:
Private Sub Label1_Click()
URL = "http://www.baidu.com"
Call ShellExecute(Me.hwnd, "op