Using IsComObjectCreated

You can test to see if a COM object exists by getting the value of IsComObjectCreated from its DataFlex wrapper object. This function returns True, if the COM object has been created indicating that it is safe to access its interface.

The following example from the Simple Automation Controller sample demonstrates the use of IsComObjectCreated…

Object oText_Btn is a Button

    Set Location to 10 10

 

    Procedure OnClick

        // Get the text from the COM Automation Server and display it.

        String sValue

        Boolean bIsComObjectCreated

 

        // Test to see If we are already connected. If we are connected,

        // then the IsComObjectCreated Returns True.

        Get IsComObjectCreated of oAutomationTest to bIsComObjectCreated

 

        If (bIsComObjectCreated) Begin

            Get ComEditText of oAutomationTest to sValue

            Set Value of oText_frm to sValue

        End

    End_Procedure // OnClick

End_Object

 

See Also

Programming with COM – General Topics