W
wangyv
Unregistered / Unconfirmed
GUEST, unregistred user!
在mts对象中创建mts对象时,在Tmtsobject.initialize;过程中的代码如下:
begin
inherited;
if objectcontext=nil then
begin
customersobj:=comtscustomers.Create;
ordersobj :=comtsorders.Create;
showmessage('no object context, use create');
end
else
begin
olecheck(objectcontext.CreateInstance(class_mtscustomers,iid_imtscustomers,customersobj));
olecheck(objectcontext.CreateInstance(class_mtsorders, iid_imtsorders, ordersobj ));
showmessage('object context exists, use createinstance');
end;
end;
begin
inherited;
if objectcontext=nil then
begin
customersobj:=comtscustomers.Create;
ordersobj :=comtsorders.Create;
showmessage('no object context, use create');
end
else
begin
olecheck(objectcontext.CreateInstance(class_mtscustomers,iid_imtscustomers,customersobj));
olecheck(objectcontext.CreateInstance(class_mtsorders, iid_imtsorders, ordersobj ));
showmessage('object context exists, use createinstance');
end;
end;