IsComObjectCreated - cComActiveXControl

Tests to see if a COM object exists by getting the value of IsComObjectCreated

Type: Function

Return Data Type: Boolean

Parameters: None

Return Value

This function returns True, if the COM object has been created indicating that it is safe to access its interface.


Syntax
Function IsComObjectCreated Returns Boolean

Call: Get IsComObjectCreated to BooleanVariable


Description

You can test to see if a COM object exists by getting the value of IsComObjectCreated.

This is analogous to testing if the pvComObject property is Not Null (created), or Null (released).

The following example demonstrates the use of IsComObjectCreated in the OnClick event of a button object.

Procedure OnClick
    Boolean bIsComObjectCreated

    // test If the calendar ActiveX control currently exists.
    Get IsComObjectCreated of oCalendar1 To bIsComObjectCreated
    If (bIsComObjectCreated) Begin
        // Set the calendar's date to today's date
        Send ComToday of oCalendar1
    End
End_Procedure


Testing IsComObjectCreated is crucial to writing error free COM applications. You should test this value before executing any code that accesses a COM object's interface methods or properties. The exception to this rule is when you access a COM object inside an OnCreate event handler.