Re: Detecting shift/alt keys



On Thu, 21 Apr 2005 14:24:54 +0100, Dodgy
<Dodgy@xxxxxxxxxxxxxxxxxxxxx> wrote:

>On Thu, 21 Apr 2005 13:40:04 +0100, Peter <peter@xxxxxxxxxxx> waffled
>on about something:
>
>>Hi,
>>
>>I have a form with several controls.
>>
>>How do I detect when a user presses the shift or alt keys? I can't
>>seem to trap any keys using formkeypress or formkeydown.
>>
>>I have a couple of speed buttons and I want them to also be activated
>>on either a SHIFT or ALT key being pressed.
>>
>>Thanks.
>
> if HiWord(GetKeyState(vk_shift))<>0 then
> // it's down
> else
> // it's up
>
>The alt key is vk_menu
>
>Full list here.
>
>http://delphi.about.com/od/objectpascalide/l/blvkc.htm
>
>Hope this helps.

Thanks.

What I don't understand is where I should be checking. Form.onkeydown
and form.onkeypress don't seem to do anything.

Sorry but I'm a bit of a newbie to Delphi!

.


Quantcast