delphi把ActiveForm当作一个控件来处理,
当ActiveForm里面有Memo等控件的时候,
ActiveForm并不处理CN_KeyDown(VCL control notification IDs)消息,
也就是说过滤掉了内含Vcl内部的KeyDown消息。
所以你的ActiveForm如果有Memo等控件,你需要自己给ActiveForm加上CN_KeyDown消息的处理。
比如说我的ActiveForm上有个Memo.
type
TForm1 = class(TForm)
Button1: TButton;
Actfrm: TActiveFormXdj;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
OldActfrmWndProc: TWndMethod;
procedure ActfrmWndProc(var msg: TMessage);Message CN_KEYDOWN;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ActfrmWndProc(var msg: TMessage);
begin
if (Msg.wParam =VK_Left)or(Msg.wParam =VK_Return)or(Msg.wParam =VK_Up)or(Msg.wParam =VK_Right)or(Msg.wParam =VK_Down) then
begin
end
else
begin
Inherited;
OldActfrmWndProc(msg);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldActfrmWndProc := Actfrm.WindowProc;
Actfrm.windowProc := ActfrmWndProc;
end;