...detect if Alt, Shift, Control are pressed?

Author: Thomas Stutz

Category: System

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;

 

printed from
www.swissdelphicenter.ch
developers knowledge base