私立妇儿医院排名:这和谁明白

来源:百度文库 编辑:高校问答 时间:2024/05/05 08:15:52
Dim AddKey
KeyResult = GetAsyncKeyState(13) '回车键
If KeyResult = -32767 Then
AddKey = "[ENTER]"
GoTo KeyFound
End If
KeyResult = GetAsyncKeyState(17) 'Ctrl键
If KeyResult = -32767 Then
AddKey = "[CTRL]"
GoTo KeyFound
End If
KeyResult = GetAsyncKeyState(8) '退格键
If KeyResult = -32767 Then
AddKey = "[BKSPACE]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(9)
If KeyResult = -32767 Then
AddKey = "[TAB]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(18)
If KeyResult = -32767 Then
AddKey = "[ALT]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(19)
If KeyResult = -32767 Then
AddKey = "[PAUSE]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(20)
If KeyResult = -32767 Then
AddKey = "[CAPS]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(27)
If KeyResult = -32767 Then
AddKey = "[ESC]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(33)
If KeyResult = -32767 Then
AddKey = "[PGUP]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(34)
If KeyResult = -32767 Then
AddKey = "[PGDN]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(35)
If KeyResult = -32767 Then
AddKey = "[END]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(36)
If KeyResult = -32767 Then
AddKey = "[HOME]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(44)
If KeyResult = -32767 Then
AddKey = "[SYSRQ]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(45)
If KeyResult = -32767 Then
AddKey = "[INS]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(46)
If KeyResult = -32767 Then
AddKey = "[DEL]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(144)
If KeyResult = -32767 Then
AddKey = "[NUM]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(37)
If KeyResult = -32767 Then
AddKey = "[LEFT]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(38)
If KeyResult = -32767 Then
AddKey = "[UP]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(39)
If KeyResult = -32767 Then
AddKey = "[RIGHT]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(40)
If KeyResult = -32767 Then
AddKey = "[DOWN]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(112)
If KeyResult = -32767 Then
AddKey = "[F1]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(113)
If KeyResult = -32767 Then
AddKey = "[F2]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(114)
If KeyResult = -32767 Then
AddKey = "[F3]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(115)
If KeyResult = -32767 Then
AddKey = "[F4]"
GoTo KeyFound
End If

KeyResult = GetAsyncKeyState(116)
If KeyResult = -32767 Then
AddKey = "[F5]"

GoTo KeyFound
End If

KeyLoop = 41

Do Until KeyLoop = 256 ' 显示其他键
KeyResult = GetAsyncKeyState(KeyLoop)
If KeyResult = -32767 Then Text1.Text = Text1.Text + Chr(KeyLoop)
KeyLoop = KeyLoop + 1
Loop
LastKey = AddKey
Exit Sub
KeyFound: '显示键的信息

Text1 = Text1 & AddKey
End Sub

以上是截获功能键并显示在文本框中.由于功能键为不可打印字符,所以程序用对应的英文代替,如[F1],[F2],[RIGHT],[ENTER]...

....数学+英语