Re: Detecting shift/alt keys



"alanglloyd@xxxxxxx" wrote:
>
> > The onkeydown, onkeyup aren't issued for the "special" keys like
> > shift, ctrl and alt.
>
> Well they do OK in D3 on the form's OnKeyDown/Up. They certainly don't
> in OnKeyPress because only an ASCII key will trigger that event
> handler.
>
> I usually use ...
>
> if GetKeyState(VK_?????) < 0 then ...
>
> for pressed
>
> .. and of course toggleable keys are ...
>
> if Odd(GetKeyState(VK_INSERT)) then ...
>
> for toggled on.
>
> note that (at least in D3) the alpha-digit virtual-key codes (VK_A to
> VK_Z etc) are not defined in Delphi.
>
> Alan Lloyd

They didn't bother to define them because they are the same as the
ASCII codes for the letters.

>From D5 windows.pas
{ VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' ($41 - $5A) }

Cheers Hanford
.