Home > Back-end >  How to capture the key combination hotkey controls attribute value
How to capture the key combination hotkey controls attribute value

Time:09-17

How from a hotkey control combination keys?

In order to register the system hotkey, want to get keys from hotkey controls weight
W:=HotKey1. HotKey;
H:=Hi (w); {to obtain high byte}
L:=Lo (w); {get low byte}

HotKeyId1:=GlobalAddAtom (' MyHotKey1 ');
RegisterHotKey (Handle, HotKeyId1, h, l)

But not registered success, l value for normal, h value is unable to obtain normal, check only baidu key combination CTRL, ALT, SHIFT

Other are shortcuts, including F1 to F12, letters, Numbers, use IntToStr, can accurately obtain keys

So, how to accurately obtain key combination CTRL, ALT, SHIFT the value of the register??

CodePudding user response:

Fewer people are now using Delphi, can only wait

CodePudding user response:

THotKey component is Windows Hot Key packaging, don't use RegisterHotKey,

CodePudding user response:

refer to the second floor DelphiGuy response:
THotKey component is Windows Hot Key packaging, don't use RegisterHotKey,


Finally someone help me to take a look at this problem, tears fall!
Consult a great god, then the code should how to write?

CodePudding user response:

Don't know what are you going to do...

CodePudding user response:

reference 4 floor DelphiGuy response:
don't know what are you going to do...

Let users through Thotkey controls set they want shortcuts, rather than the program shortcut died there

CodePudding user response:

It is very simple, such as a menuitem, called be, just need to be the shortcut:=HotKey1. HotKey. If runtime allows the user to change the hotkey, the definition of the need to write an onchange event processing, inside reset, such as to be again. The shortcut:=HotKey1. Hotkey.
By default hotkey components can be input at run time, so that users can directly change, you only need to in the onchange into law, if you don't let it show, can also program mode Settings:
HotKey1. HotKey:=word (' A ');
HotKey1. Modifiers:=[hkAlt];

CodePudding user response:

refer to 6th floor DelphiGuy response:
it is very simple, such as a menuitem, called be, just need to be the shortcut:=HotKey1. HotKey. If runtime allows the user to change the hotkey, the definition of the need to write an onchange event processing, inside reset, such as to be again. The shortcut:=HotKey1. Hotkey.
By default hotkey components can be input at run time, so that users can directly change, you only need to in the onchange into law, if you don't let it show, can also program mode Settings:
HotKey1. HotKey:=word (' A ');
HotKey1. Modifiers:=[hkAlt];

Thank you, ask, make global shortcuts?
Such as the program needs to hide or background; After press shortcuts to other Windows.
Is to write a script, such as the mouse operation

CodePudding user response:

Can use the SetWindowsHookEx set the keyboard or the mouse hook, there are many online, for example,

  • Related