Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problem with HotKey

Problem with HotKey

Problem with HotKey


In my App I have some HotKey that is registred, unregistred like below:

TufMain = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
{ Private declarations }
ExecuteHotKey: Integer;
procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
{ Public declarations }


procedure TufMain.WMHotKey(var Msg: TWMHotKey);
if (msg.HotKey = ExecuteHotKey) then
... something to do

procedure TufMain.FormCreate(Sender: TObject);
ExecuteHotKey := GlobalAddAtom('ExecuteHotKey');
RegisterHotKey(Handle, ExecuteHotKey, 0, VK_F2);

procedure TufMain.FormDestroy(Sender: TObject);
UnRegisterHotKey(Handle, ExecuteHotKey);

In mp App everything works OK, but I've noticed that when I use other application where F2 can be used, I cannot use it, e.g. Excel - I want to edit cell by pressing F2, but it does not work.
I must close my App and then F2 in Excel works normally.
With other HotKey that are the same in my App and other applications (e.g. ESC), is the same.
It seems that my App blocks HotKey in other applications ...
Does anyone know how to solve it?
Thank you in advance.

RE: Problem with HotKey

I just tested it and imex's answer will work. Stars for both, imex for a good answer, the op because I was about to look into how to do a global hotkey from my app.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.

RE: Problem with HotKey

It works! Thanks a lot.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close