换言之,在祖先Form中定义的热键,如何让它在子孙窗口中成为一个事件样的供调用?
如:1.procedure TFrmParent.FormCreate(Sender: TObject);
Var
vs_status :String;
begin
id:=GlobalAddAtom('hotkey');
RegisterHotKey(handle,id,mod_control,83);
End;
2.procedure TFrmParent.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(handle,id); //别忘了在退出时取消定义
end;
3.想定义一个事件在子孙窗口中可见,在安上面的热键时触发
如:1.procedure TFrmParent.FormCreate(Sender: TObject);
Var
vs_status :String;
begin
id:=GlobalAddAtom('hotkey');
RegisterHotKey(handle,id,mod_control,83);
End;
2.procedure TFrmParent.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(handle,id); //别忘了在退出时取消定义
end;
3.想定义一个事件在子孙窗口中可见,在安上面的热键时触发
热键怎么用你应该知道吧在父类中,定义一个虚函数procedure DoCtrlW;vitrual,当收到热键消息就调用这个函数
定义一个事件属性property OnCtrlW:TNotifyEvent read FOnCtrlW write FOnCtrlW;
在子类中,重载这个虚函数,
procedure Doctrlw;override;
begin
inherited;
if assigned(OnCtrlW) then
OnCtrlW(nil);
end;事件 OnCtrlW就是你要的热键触发的事件。