Solved

Press three keys together and trigger a function

Posted on 2016-10-12
3
38 Views
Last Modified: 2016-10-12
Hello,

I want to combine three keys together CTRL + ALT + F12 and shoot a message with ShowMessage('OK')

how can I do this in my form?

Thanks
Alex
0
Comment
Question by:hidrau
3 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 41840137
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
If (key = vk_F12) and (ssCtrl in Shift) and (ssAlt in Shift) then ShowMessage('OK');
end;

Open in new window

0
 
LVL 36

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 250 total points
ID: 41840678
that's assuming keypreview is true on your form ...

and some other app has not registered this shortcut key with windows RegisterHotKey
otherwise your app will not get the key

here is such an approach
http://www.delphitips.net/2007/04/01/global-system-hotkey/
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 41840768
thanks a lot
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now