Como primera observación, no se trata de un Hook, se trata de una HotKey.
Como segunda observación yo probaría registrarlo directamente a la ventana en cuestión, a no ser que se trate de un MDI, de ser así verificaría que AppMessage este recibiendo los mensajes de la apliación.
Escribí esto, y funciona sin problemas:
Código Delphi
[-]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
protected
aCapital,
aNumLock: ATOM;
procedure WMHotKey(var Message: TWMHotKey); message WM_HOTKEY;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
WM_CAPITAL = WM_USER + 1;
WM_NUMLOCK = WM_USER + 2;
procedure TForm1.FormCreate(Sender: TObject);
begin
aCapital := GlobalAddAtom('WM_CAPITAL');
aNumLock := GlobalAddAtom('WM_NUMLOCK');
RegisterHotKey(Handle, aCapital, 0, VK_CAPITAL);
RegisterHotKey(Handle, aNumLock, 0, VK_NUMLOCK);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Handle, aCapital);
UnRegisterHotKey(Handle, aNumLock);
GlobalDeleteAtom(aCapital);
GlobalDeleteAtom(aNumLock);
end;
procedure TForm1.WMHotKey(var Message: TWMHotKey);
begin
if Message.HotKey = aCapital then
Memo1.Lines.Add('CAPS LOCK');
if Message.HotKey = aNumLock then
Memo1.Lines.Add('NUM LOCK');
end;
end.
Saludos!