參見http://www.wangchao.net.cn/bbsdetail_47176.html
外部調用Vote1.Base :=Base1.DefaultInterface;
Base屬性設置爲Read|Write|Write byref, Type 爲Base*。
procedure TVote.Set_Base(const Value: Base);
var
eEntry: PInterfaceEntry;
eAutoObjFactory: TAutoObjectFactory;
begin
FBase := Value;
//得到類工廠
eAutoObjFactory:= TAutoObjectFactory(ComClassManager.GetFactoryFromClassID(CLASS_Base));
//得到接口標識的接口項
eEntry:= eAutoObjFactory.DispIntfEntry;
//IOffset爲接口的偏移地址,eResource減去IOffset所得到的地址就是對象實例
FTBase:= TBase(Integer(FBase)-eEntry.IOffset);
if FTBase <>nil then
FTBase.OnTimerOK :=eveTimeOK
else
FTBase.OnTimerOK := nil;
end;