How to detect pressed keys outside application ? lazarus / 21-General ---------------------------------------------------------------------- flax57 · 2021-06-07 01:10 Hello @ll, How to detect pressed keys outside application. i use  TForm1.FormKeyDown event and i have activate KeyPreview option in MainForm, but it detect only pressed keys if MainForm is in focus. This code only works if the focus set to the MainForm and isn't the case if you are outside application(system wide). Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);begin  if key=VK_F4 then ShowMessage('F4 Key Pressed')end; [Edited to add code tags - please see How to use the Forums.] ---------------------------------------------------------------------- ADMGNS · 2021-06-09 13:38 hello, there are several methods to capture key strokes, but, the simplest way is to use GetAsyncKeyState. a mini demo is at attachment, for windows (tested at win7). good luck