Visual FoxPro Key Codes Example

FAR EventHandler(WHandle theWindow, EventRec FAR *ev) 
{
switch(ev->what)
{
case keyDownEvent:                  /* Check the keyDownEvent */
if (ev->modifiers & shiftCodeMask)      /* A modifier was pressed. */
{
if (ev->modifiers & altKey)            /* Check for the ALT Key */
_PutStr("ALT Key Code should be used.\n"); 
else
if (ev->modifiers & ctrlKey)         /* CTRL Key */
_PutStr("CTRL Key Code should be used.\n");
else
if (ev->modifiers & shiftKey)         /* SHIFT Key */
_PutStr("SHIFT Key Code should be used.\n");
}
else
_PutStr("Regular Key Code should be used.\n"); 
return NO;                        /* Let Visual FoxPro have Key also */ 
break;
default:
return NO;
}
}

Note   shiftCodeMask, altKey, ctrlKey, and shiftKey are all defined in PRO_EXT.H and PRO_EXT.INC as follows:

#define  shiftCodeMask  0xf000

#define  shiftKey  0x1000

#define  ctrlKey  0x2000

#define  altKey  0x4000