Method AutomationObject():destroy() Foundation

Disconnects from a COM/ActiveX component.

Syntax
:destroy() --> self
Return

This method returns the object executing the method (self).

Description

The method :destroy() disconnects the ActiveXObject from the COM/ActiveX component. The connection between an AutomationObject and a COM/ActiveX object is established by the method :create()or the functions GetObject() and CreateObject().

The method :destroy() can be used for optimization purposes. Under normal circumstances, the connection between AutomationObjects and COM/ActiveX components is removed automatically by the Xbase++ Garbage Collector. However, in situations where a large number of AutomationObjects is created in a loop, for example, the asynchronuous nature of the Garbage Collector may cause unused AutomationObjects to accumulate before they are freed. Using method :destroy() to disconnect may increase application performance in such situations.

:destroy() does not necessarily remove the COM/ActiveX object from memory. If the COM/ActiveX component is hosted by an out-of-process automation server, the server often needs to be shut down explicitly before the COM/ActiveX component is freed. The Microsoft Office applications are a good example for this group of COM/ActiveX components. Please consult the documentation of the COM/ActiveX component for further information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.