Press three keys together and trigger a function

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
LVL 1
hidrauAsked:
Who is Participating?
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
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
 
Geert GOracle dbaCommented:
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
 
hidrauAuthor Commented:
thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.