■ Access VBA 実行コード
Private Declare Function GetAsyncKeyState Lib "User32.dll" (ByVal vKey As Long) As Long
Public Sub MyKeyin()
Dim lkey As Long
Forms!フォーム1.Caption = "start"
Do Until GetAsyncKeyState(27) <> 0
If GetAsyncKeyState(vbKeyUp) <> 0 Then
Forms!フォーム1.Caption = "上"
ElseIf GetAsyncKeyState(vbKeyDown) <> 0 Then
Forms!フォーム1.Caption = "下"
ElseIf GetAsyncKeyState(vbKeyLeft) <> 0 Then
Forms!フォーム1.Caption = "左"
ElseIf GetAsyncKeyState(vbKeyRight) <> 0 Then
Forms!フォーム1.Caption = "右"
Else
Forms!フォーム1.Caption = "なし"
End If
DoEvents
Loop
Forms!フォーム1.Caption = "end"
End Sub