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 Sub Command1_Click()
Shell ("explorer http://www.126.com")
End Sub
```````````````````````````````````````````````````````````````````````````````````
测试代码,Combo1,List1中的应用:
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 Sub Combo1_Click()
If Combo1.Text = "Jiangmin" Then
Shell "explorer http://www.Jiangmin.com"
ElseIf Combo1.Text = "网易" Then
Shell "explorer http://www.163.com"
ElseIf Combo1.Text = "新浪" Then
Shell "explorer http://www.sina.com"
End If
End Sub
Private Sub Form_Load()
Combo1.AddItem "Jiangmin"
Combo1.AddItem "网易"
Combo1.AddItem "新浪"
List1.AddItem "Jiangmin"
List1.AddItem "网易"
List1.AddItem "新浪"
List1.AddItem "Yahoo"
List1.AddItem "126"
End Sub
Private Sub List1_dblClick()
If List1.Text = "Jiangmin" Then
Shell "explorer http://www.Jiangmin.com"
ElseIf List1.Text = "网易" Then
Shell "explorer http://www.163.com"
ElseIf List1.Text = "新浪" Then
Shell "explorer http://www.sina.com"
ElseIf List1.Text = "Yahoo" Then
Shell "explorer http://www.yahoo.com.cn"
ElseIf List1.Text = "126" Then
Shell "explorer http://www.126.com"
End If
End Sub