FlexCOM 2 Overview

Introduction

FlexCOM is the technology that allows DataFlex to interact with COM controls. FlexCOM is used throughout the product and tools, such as the Studio.

Variant Data Type

The variant data type is quite heavily used when working with COM controls. For more information refer to:

Variant Command in the Language Reference,

Variants in the Language Guide,

Variant Data Type in "Programming with COM - General Topics". 

Improved Binding to COM Objects

The FlexCOM 2 classes support the following interface for managing references to COM objects:

pvComObject  – This is a variant property which returns an IDispatch pointer to the external COM object. Setting this property to the correct IDispatch* value connects a DataFlex wrapper object to its corresponding external COM object and increments its reference count. Changing this property or setting it to NULL (using the NullComObject()  function) automatically releases that reference. Destroying the DataFlex wrapper object also automatically releases the reference to the COM object.

CreateComObject  - This method replaces the old CreateDispatch method.

ReleaseComObject – This method replaces the old ReleaseDispatch method.

IsComObjectCreated – This Boolean function returns True if pvComObject is set to some valid IDispatch* value. It returns false if pvComObject is NULL or unassigned.

FlexCOM Helper Functions

There are several FlexCOM Helper Functions available to developers for operating on Variant properties or variables that are used to store IDispatch* values:

IsComObject() – This function returns True if the passed value is a non-Null IDispatch* value.

NullComObject() – This function returns a NULL value of variant type IDispatch*. You can use this function to release a reference to a COM object that is stored in a variant property or variable, or to initialize a variant property or variable.

IsNullComObject(vSomeVariant) – This Boolean function returns True if the passed variable or property is of type variant IDispatch* and is set to NULL. It will return False if the passed value is a non-NULL IDispatch* value.

IsSameComObject(vSomeVariant1, vSomeVariant2) – This Boolean function returns True if the two parameters are of type Variant and point to the same COM object.

Studio Integration

In the Studio, developers can quickly import ActiveX, COM Automation, and embedded COM controls into their applications by generating wrapper classes. For more information refer to:

Importing COM Components

Using the Built-in ActiveX Properties Dialog

 
 

See Also

Using COM