I actually use late binding in delphi, and I need to know that this is the right way to work with it.
My main problem is how do I handle the memory used by these objects, should I free the memory?
check this code example
var
chEaten: Integer;
BindCtx: IBindCtx;
Moniker: IMoniker;
MyObject:: IDispatch;
begin
try
OleCheck(CreateBindCtx(0, bindCtx));
OleCheck(MkParseDisplayName(BindCtx, StringToOleStr('oleobject.class'), chEaten, Moniker));
OleCheck(Moniker.BindToObject(BindCtx, nil, IDispatch, MyObject));
MyObject.Metod1();
MyObject.Metod2();
finally
MyObject:=nil,// is this necesary?
end;
end;
it would be helpful if someone briefly explained how memory is processed in this type of object.
early.
source
share