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
#2
Ctrl-Alt-Delete is a system reserved key combo usually.
Reply
#3
Yes, Ctrl-Alt-Del is trapped by the SAS event which in turn calls the Gina.dll library.

The only way to trap your own event is by re-writing the Gina library.

Erik.

SAS is the secure attention sequence.
https://msdn.microsoft.com/en-us/library...s.85).aspx
Reply




Users browsing this thread: 3 Guest(s)