[comp.windows.ms] receiving virtual keyboard commands

jupiter@hpavla.AVO.HP.COM (Shirley Jupiter) (02/02/90)

The message sent to the window is the WM_KEYDOWN message, with wParam being
the virtual key code (VK_UP, VK_LEFT, etc.).




--Shirley Jupiter
  Hewlett-Packard
  Avondale Division
  jupiter@hpavla.AVO.HP.COM

bturner@hpcvlx.cv.hp.com (Bill Turner) (02/02/90)

> Hi, what kind of message does a program receive when a virtual key is
> pressed, i.e. VK_RIGHT, VK_UP, etc...

All keystroke messages come in under the WM_KEYDOWN and WM_KEYUP messages.
However, for ASCII keys, this isn't too helpful, which is why there is the
call to TranslateMessage in your main loop.

The message sequence for an ASCII key ('A', for example) is

    WM_KEYDOWN,  wParam = VK_A
    WM_CHAR, wParam = 'A' (or 'a', depending on the shift key state)
    WM_KEYUP, wParam = VK_A

--Bill Turner (bturner@hp-pcd.hp.com)
HP Interface Technology Operation

marco@hpmcaa.mcm.hp.com (Marco Dalla-Gasperina) (02/02/90)

>/ hpmcaa:comp.windows.ms / kipnis@janus.Berkeley.EDU (Gary Kipnis) / 12:22 pm  Jan 31, 1990 /
>Hi, what kind of message does a program receive when a virtual key is
>pressed, i.e. VK_RIGHT, VK_UP, etc...
>
>thanks,
>
>gary
>----------

Those keys generate WM_KEYDOWN and WM_KEYUP messages.  There is no 
WM_CHAR message generated. You can try by using SPY.

marco