Forum > Windows

Fire the CTRL-F9 button everywhere in windows 10.

(1/2) > >>


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState  );begin   if (Shift = [ssCtrl]) AND (Key = 120) then memo1.Lines.Append('Ctrl F9');end;
Like this it got to work to receive the CTRL-F9 key when pressed on the form.

Does anybody know what to change to fire the code from the CTRL-F9 key, everywhere in windows 10 ? Even though the form is not focused ?

Greets, Wouter van Wegen

Especially Lazarus users are going to thank you for "stealing" Ctrl+F9  O:-)


CTRL-F10 will also do.

Just as it responds everywhere in windows when application not focused.

google: msdn global key hook

In Delphi this is done via applicationevents.shortcut

--- Code: ---procedure TRootMain.ApplicationEvents1ShortCut(var Msg: TWMKey;
  var Handled: Boolean);

 RawMessage: TMessage;
 fkey,shift : integer;
 if not assigned(basehandling) or not allowkeys then
 // Kijk in de raw message welke message er gestuurd is.

{  if Msg.Msg = WM_KEYDOWN then
   // Debug: Log de tijd in een memo op het main form om te zien of het werkt.
   // Memo1.Lines.Insert(0, DateTimeToStr(Now));
   // Gebruik een 'normale' TMessage omdat dat makkelijker is.

   RawMessage:= TMessage(Msg);

   // Die is namelijk eventueel te typecasten naar een speciaal daarvoor
   // gemaakt record. Je kunt natuurlijk ook rechtstreeks de WParam en LParam
   // van Msg gaan ontleden, maar dit is makkelijker.

   if (msg.CharCode >=VK_F1) and (msg.CharCode <=VK_F12) and not BaseHandling.canclose  then
       if HiByte(GetKeyState(VK_SHIFT))>0 then inc(shift,1);
       if (HiByte(GetKeyState(VK_MENU))>0) then inc(shift,2);
       if (HiByte(GetKeyState(VK_CONTROL))>0) then inc(shift,4);

--- End code ---


[0] Message Index

[#] Next page

Go to full version