I'm using IHTMLDocument2 as this:
var
doc: OleVariant;
doc:= coHTMLDocument.Create as IHTMLDocument2;
doc:= CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
doc.write(html);
doc.close;
(...)
How should I dispose of "doc" properly?
I'm using IHTMLDocument2 as this:
var
doc: OleVariant;
doc:= coHTMLDocument.Create as IHTMLDocument2;
doc:= CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
doc.write(html);
doc.close;
(...)
How should I dispose of "doc" properly?
You don't have to do anything to dispose of it, if
docis a local variable (within a procedure or function).IHTMLDocument2is an interface and is reference counted; the compiler will make sure it's released when it goes out of scope.If it's not a local variable, you can simply set it to
nullorUnassigned, as indoc := Unassigned;which will decrement the reference count.