Register Global HotKey:
1.first to declare the message funciton    procedure WMhotKey(var Message: TMessage); message WM_HOTKEY;2.
var
  id: ATOM;procedure TForm1.FormCreate(Sender: TObject);
begin
  id := GlobalAddAtom('GetScreenColor_HotKey_F12');
  if not RegisterHotKey(Form1.Handle, id, 0, $7B) then  //Register F12
    ShowMessage('Can not Register HotKey!');
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
  if not UnregisterHotKey(Form1.Handle, id) then
    ShowMessage('Can not Unregister HotKey!');
  GlobalDeleteAtom(id);
end;procedure TForm1.WMhotKey(var Message: TMessage);
begin
  if HIWORD(Message.lParam) = $7B then
  begin
    //do what u want
  end;
end;

解决方案 »

  1.   

    为控件加外观名字,用TLabel的属性FocusControl连接上控件的焦点
    就是用“&”方式的方法
      

  2.   

    RegisterHotKey是一个全局的热键设置。就算是你的窗体没有获得焦点,WM_HOTKEY事件也能发生。是个比较有用的东东。
      

  3.   

    对头,上面的代码在你的窗体没有焦点的情况下也是能够执行的,所以称作Global HotKey!