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() Dim a As Long a = ShellExecute(0, "open", "http://www.csdn.net", vbNull, vbNull, 0) End Sub
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", "www.sohu.com", vbNullString, vbNullString, 1 End Sub
不用API也可以shell "start http://www.sohu.com"
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_DbClick() Dim OpenUrl As Long OpenUrl = ShellExecute(0, "open", lablel1.caption, vbNull, vbNull, 0) End Sub
Private Sub Label1_Click() Shell "explorer http://www.csdn.net" End Sub
Dim a As Long
a = ShellExecute(0, "open", "http://www.csdn.net", vbNull, vbNull, 0)
End Sub
ShellExecute Me.hwnd, "open", "www.sohu.com", vbNullString, vbNullString, 1
End Sub
Dim OpenUrl As Long
OpenUrl = ShellExecute(0, "open", lablel1.caption, vbNull, vbNull, 0)
End Sub
Shell "explorer http://www.csdn.net"
End Sub