Progress
Language Reference
RELEASE OBJECT Statement
Releases the specified COM object (Automation object or ActiveX control) and removes all internal structures associated with the handle to the object.
SYNTAX
COM-hdl-var
A COM-HANDLE variable that references a valid COM object.
NO-ERROR
Specifies that any errors that occur in the attempt to release the object are suppressed. After the RELEASE OBJECT statement completes, you can check the ERROR-STATUS system handle for information on any errors that occurred.
EXAMPLEThis procedure fragment shows a control named hc_CmdButton being loaded into a control-frame and the handle to the control (controlHdl) being obtained using the control name (hc_CmdButton) property. Later, it releases the control and deletes the parent control-frame widget (CFWidHdl).
For an example of the RELEASE OBJECT statement applied to Automation objects, see the CREATE Automation Object Statement entry.
NOTES
- After this statement completes, any other component handles that reference the object are invalid. If you attempt to reference the object using one of these handles, Progress returns an invalid handle error. It is also possible for a newly instantiated COM object to get the same handle as one that has been released. Progress does not detect that this occurs. In this case, the “old” handle is valid, but it references a different control. Thus, it is a good practice to set any COM-HANDLE variables that reference a released COM object to the unknown value (?).
- The released COM object remains active as long as any other COM object has a valid reference to it. In the case of an ActiveX control, the parent control-frame is a COM object that references the control. All other component handle references you establish in the Progress session represent a second reference to the COM object. Thus, when you release one of these component handles, the released COM object remains active as long as the parent control-frame COM object is still active. To release the parent control-frame COM object and complete the release of the ActiveX control, you must follow any release of the ActiveX control by a delete of the parent control-frame widget.
- When you delete a control-frame widget, Progress releases all associated ActiveX controls automatically, whether or not you release them individually.
- When the session ends, Progress automatically releases any active COM objects you have not released individually.
SEE ALSO
CREATE Automation Object Statement, DELETE WIDGET Statement, DELETE WIDGET-POOL Statement
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |