Simon180 -3 Light Poster

Hello all, I been trying to add a hotkey to my application using the following code below but I have a issue were once added am no longer able to use any other shift commands as it will always call the the press commands so am wondering is there a better way of doing the code below were it allows me to use shift key for my command but also allso the normal shift commands to be used while program is open for symbols also how can I am make it so the shift key must be always pressed down to enable the command?.

procedure TGizletView.BuildMyHotKey;
const
  MOD_SHIFT = 4;
begin
  // Globally trap the Windows system keys shift and control
  ctrl_id := GlobalAddAtom('VK_LSHIFT');
  // Registering a hotkey
  RegisterHotKey(Handle, ctrl_id, MOD_SHIFT, VK_SHIFT);
end;

procedure TGizletView.WMHotKey(var Msg: TWMHotKey);
begin
  if (Msg.HotKey = ctrl_id) then
  begin
    if not KeyDown then KeyPressed(True) Else KeyPressed(False);
  end;
end;

procedure TGizletView.KeyPressed(KeyIspressed: Boolean);
begin
  if KeyIspressed then
  begin
     KeyDown := True;
   end else begin
     KeyDown := False;
  end;
end;

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.