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 Form_KeyDown(KeyCode As Integer, Shift As Integer) On Error GoTo Errhandle If KeyCode = vbKeyF1 Then ShellExecute Me.hwnd, "open", "C:\aa.hlp", vbNullString, vbNullString, 1 End If
Exit Sub Errhandle: MsgBox Err.Description & "!", vbInformation End SubPrivate Sub Form_Load() Me.KeyPreview = True End Sub
……
End If
On Error GoTo Errhandle
If KeyCode = vbKeyF1 Then
ShellExecute Me.hwnd, "open", "C:\aa.hlp", vbNullString, vbNullString, 1
End If
Exit Sub
Errhandle:
MsgBox Err.Description & "!", vbInformation
End SubPrivate Sub Form_Load()
Me.KeyPreview = True
End Sub