Mega Code Archive

 
Categories / Delphi / Hardware
 

How to detect if Alt, Shift, Control are pressed

Title: How to detect if Alt, Shift, Control are pressed function CtrlDown: Boolean; var State: TKeyboardState; begin GetKeyboardState(State); Result := ((State[VK_CONTROL] and 128) 0); end; function ShiftDown: Boolean; var State: TKeyboardState; begin GetKeyboardState(State); Result := ((State[VK_SHIFT] and 128) 0); end; function AltDown: Boolean; var State: TKeyboardState; begin GetKeyboardState(State); Result := ((State[VK_MENU] and 128) 0); end;