CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Function Keys



>  I would like to know how can I know if a user press a function key (F2, F3,
>  etc.) ?

The OnKeyDown event key == VK_F2

OnKeyDown will send a message when a key is pressed, but it returns the virtual
keys, not what you get when your editor pastes it on your screen.  Thus it will
return a 'S' when you type a lowercase 's' and it will return a VK_DOWN when
you press the down arrow.  See borlands\INCLUDE\WIN32\WINUSER.H for a list of
the Virtual Keys.

OnKeyPress will return the expected key (ASCII) so you will get a 's' when you
type 's' and a 'S' if you have caps lock on.  It will not return any of the
virtual keys (except those that have ascii maps like VK_RETURN) so you will not
get any of the Fkeys VK_F1 etc.

OnKeyDown also returns a TShiftState which will tell you which of the shift
keys and mouse keys are active.
-- Clifton Mayo


W Komornicki's Home Page | Main Index | Thread Index