在VB的form中,如何链接到网址
在form中,有一lable添加了文字,希望双击后,自动链接到相应网站。
谢谢。
[解决办法]
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", "www.sina.com", vbNullString, vbNullString, 0
[解决办法]
Private Sub Label1_DblClick()Label1.Caption = "www.google.com"'1Shell """C:\Documents and Settings\user\Local Settings\Application Data\Google\Chrome\Application\chrome.exe""" & " " & Label1.Caption'2Shell """C:\Program Files\Internet Explorer\iexplore.exe""" & " " & Label1.CaptionEnd Sub
[解决办法]
Option ExplicitPrivate Sub Form_Load() WebBrowser1.Navigate "www.163.com"End Sub