Option Explicit 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 Command1_Click() Command1.Enabled = False txStatus.Text = "" If Len(Inet1.OpenURL("http://www.ourfly.com")) <> 0 Then txStatus.Text = "已经与 Internet 连接" Else txStatus.Text = "尚未与 Internet 连接" ShellExecute 0&, vbNullString, "www.google.com", vbNullString, vbNullString, 1 End If
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 Command1_Click()
Command1.Enabled = False
txStatus.Text = "" If Len(Inet1.OpenURL("http://www.ourfly.com")) <> 0 Then
txStatus.Text = "已经与 Internet 连接"
Else
txStatus.Text = "尚未与 Internet 连接"
ShellExecute 0&, vbNullString, "www.google.com", vbNullString, vbNullString, 1
End If
Command1.Enabled = True
End Sub