你的意思是不是说向form的oncreate事件那种??TNotifyEvent = procedure(Sender: TObject) of object; ... FOnCreate: TNotifyEvent; ... property OnCreate: TNotifyEvent read FOnCreate write FOnCreate stored IsForm;..在用的时候就用foncreate这个变量procedure TCustomForm.DoCreate; begin if Assigned(FOnCreate) then try FOnCreate(Self); except if not HandleCreateException then raise; end; if fsVisible in FFormState then Visible := True; end;
在B工程中,要引用该VCL。并且要为该VCL设置代码,就像事件一样,不过不用事件驱动。
现在,要在A工程中,调用B工程中给的代码。就像继承一样。
如何实现回调函数
...
FOnCreate: TNotifyEvent;
...
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate stored IsForm;..在用的时候就用foncreate这个变量procedure TCustomForm.DoCreate;
begin
if Assigned(FOnCreate) then
try
FOnCreate(Self);
except
if not HandleCreateException then
raise;
end;
if fsVisible in FFormState then Visible := True;
end;
自己定义函数指针就行了~~~用它声明指针变量,指向某个函数使用时传递这个指针变量就可以和调用函数一样调用~~~当然上面说的只是回调函数,你说的什么,完全看不懂~~~