
Detecting key status for shift, ctrl and alt
the infinite reservoars of wisdom, and expelled:
Quote:
>I cant figure out how to check if the user is holding down one or more
>of the control, shift and alt keys. Can someone please help me? I
>trued the Keystat.VBX but that doesnt work on these keys, do I need a
>third-party VBX or can I do this in code?
Trap the keys in the _KeyDown event of the object / form (if you
set .KeyPreview to True for the Form, it will receive all key
strokes). The _KeyDown event has a flag for Ctrl, Alt and Shift
called Shift. You can find constants for the Shift flag in
CONSTANTS.TXT.
' This code traps the Ctrl key
Sub control_KeyDown (KeyValue As Integer, Shift As Integer, ....)
If Shift = CTRL_MASK Then
Msgbox "You pressed Ctrl"
End If
End Sub
Jens
--
Everything I said are the opinions of someone else.
I just cut-and-pasted.
Jens Balchen jr. http://www.*-*-*.com/ ~balchen