Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard scancodes.
#1
Hi,

I have been using the following keyboard scancodes for awhile, but I can't get it to detect Ctrl-Alt-Delete at all:

Code: (Select All)
Print "Test keyboard scancodes. Press <Esc> to quit"

On Timer(1) CtrlBreak
Timer On
x = _Exit

Const KEY_RSHIFT& = 100303
Const KEY_LSHIFT& = 100304

Const KEY_RCTRL& = 100305
Const KEY_LCTRL& = 100306

Const KEY_RALT& = 100307
Const KEY_LALT& = 100308

Do
    _Limit 100
    x& = _KeyHit
    If x& > 0 Then
        If x& = KEY_RALT& Then
            Print "Right-Alt-"
        End If
        If x& = KEY_LALT& Then
            Print "Left-Alt-"
        End If
        If x& = KEY_RSHIFT& Then
            Print "Right-Shift-"
        End If
        If x& = KEY_LSHIFT& Then
            Print "Left-Shift-"
        End If
        If x& = KEY_RCTRL& Then
            Print "Right-Ctrl-"
        End If
        If x& = KEY_LCTRL& Then
            Print "Left-Ctrl-"
        End If
    End If
    If x& < 0 Then
        Select Case x&
            Case -12
                Print "Keypad-5"
            Case -108
                Print "Ctrl-KeyPad-5"
            Case -20
                Print "Caps lock"
            Case -144
                Print "Num lock"
            Case -145
                Print "Scroll lock"
            Case -44
                Print "Print-Screen"
                'Case Else
                '    Print x&
        End Select
    End If
    x$ = InKey$
    If Len(x$) Then
        If x$ = Chr$(27) Then
            Exit Do
        Else
            If Len(x$) = 2 Then
                Print Asc(Right$(x$, 1))
            Else
                Print Asc(x$)
            End If
        End If
    End If
Loop
Timer Off
End

Sub CtrlBreak
    x = _Exit
    If x Then
        Print "Ctrl-Break"
    End If
End Sub
Reply


Messages In This Thread
Keyboard scancodes. - by eoredson - 04-30-2023, 05:23 AM
RE: Keyboard scancodes. - by SMcNeill - 04-30-2023, 05:48 AM
RE: Keyboard scancodes. - by eoredson - 05-01-2023, 03:32 AM



Users browsing this thread: 4 Guest(s)