Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Using COM Objects in ABL : Managing COM objects in an application : Validating component handles
 
Validating component handles
If you reference a COM-HANDLE variable whose value does not point to a valid COM object, ABL returns an error indicating that an action was performed on an invalid COM-HANDLE. To protect against this error, use the ABL VALID-HANDLE function to determine if the COM-HANDLE variable contains a valid value before using it in any other ABL statement. As with widget handles, the VALID-HANDLE function returns TRUE if the component handle is valid.
Note that you cannot use the VALID-HANDLE function to verify that a component handle value points to a particular COM object. COM-HANDLE values might be reused within an application when the COM objects they point to are no longer available. For more information, see ManagingCOM object resources.
Also, this function only indicates that a component handle is invalid from some action (or inaction) of the OpenEdge application. It does not show as invalid a COM handle that a user might have manually closed, for example, an Automation Server application that provided the COM object.