A
anndy1999
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的程序运行之后,第一次可以成功拦截键盘消息,弹出showmessage框,但之后再也无法了。
这是为何呢?
OldWndProc: TWndMethod;
procedure WndProc(var msg: TMessage);Message CN_KEYDOWN;
procedure TAFXTest.WndProc(var msg: TMessage);
begin
if (Msg.wParam =VK_Left)or(Msg.wParam =VK_Up)or(Msg.wParam =VK_Right)or(Msg.wParam =VK_Down) then
begin
showmessage('test');
end
else
begin
Inherited;
OldWndProc(msg);
end;
end;
procedure TAFXSDD.ActiveFormCreate(Sender: TObject);
begin
OldWndProc := Self.WindowProc;
end;
只有5分了,希望大家不要嫌少哈
这是为何呢?
OldWndProc: TWndMethod;
procedure WndProc(var msg: TMessage);Message CN_KEYDOWN;
procedure TAFXTest.WndProc(var msg: TMessage);
begin
if (Msg.wParam =VK_Left)or(Msg.wParam =VK_Up)or(Msg.wParam =VK_Right)or(Msg.wParam =VK_Down) then
begin
showmessage('test');
end
else
begin
Inherited;
OldWndProc(msg);
end;
end;
procedure TAFXSDD.ActiveFormCreate(Sender: TObject);
begin
OldWndProc := Self.WindowProc;
end;
只有5分了,希望大家不要嫌少哈