请高手用VB写段代码
发布网友
发布时间:2022-06-02 02:40
我来回答
共3个回答
热心网友
时间:2023-10-25 23:07
Option Explicit
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 112 Then
Shell "winmine.exe", vbNormalFocus
End If
If KeyCode = 113 Then
Shell "freecell.exe", vbNormalFocus
End If
If KeyCode = 114 Then
Shell "spider.exe", vbNormalFocus
End If
If KeyCode = 115 Then
Shell "sol.exe", vbNormalFocus
End If
End Sub
热心网友
时间:2023-10-25 23:07
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Key = VBkeyF1 Then
Shell "winmine.exe", vbNormalFocus
End If
If Key = VBkeyF2 Then
Shell "freecell.exe", vbNormalFocus
End If
If Key = VBkeyF3 Then
Shell "spider.exe", vbNormalFocus
End If
If Key = VBkeyF4 Then
Shell "sol.exe", vbNormalFocus
End If
End Sub
要么换成ASCII码。F1-F4:112-115
热心网友
时间:2023-10-25 23:08
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF1
Shell "winmine.exe", vbNormalFocus
Case vbKeyF2
Shell "freecell.exe", vbNormalFocus
Case vbKeyF3
Shell "spider.exe", vbNormalFocus
Case vbKeyF4
Shell "sol.exe", vbNormalFocus
End Select
End Sub