FlexCOM is a framework that makes Component Object Model (COM) technology from Microsoft available for DataFlex developers. By using FlexCOM, a DataFlex developer can implement solutions with COM technology directly within a DataFlex application.
DataFlex provides wizards and classes that make it easy to implement applications based on COM. With these wizards, you can create COM-based classes and controls to use within applications.
This documentation will not describe COM technology in depth. Instead, it is intended to describe how to use COM objects in your DataFlex applications.
The Component Object Model (COM) forms the basis on which OLE and ActiveX technology is built. COM enables communication between components, applications, and between clients and servers through clearly defined interfaces.
Interfaces are essentially tables of functions associated with a COM Object. You can call the methods of an interface just like you call the methods of any other DataFlex object.
There is an ever growing and extending set of capabilities based in COM technology. Today, these capabilities can be divided into three major categories: ActiveX Controls, Automation and Embedded Objects.
An ActiveX Control (OCX) is a custom control, which can be a simple control such as a button, or a complicated control containing several other controls such as the Microsoft Calendar Control or a complete Web browser.
An ActiveX Control can be inserted in an application’s window, for a user to interact with. And the application can call several functions/procedures and get and set properties exposed by the Control. An ActiveX Control can also send events, informing the application of different changes in its state, such as the user clicked on the control or the control has completed an asynchronous function and so on.
An ActiveX Control does not have to be a visualized custom control, though it usually is, it can be a non-visualized control simply exposing functionality and sending events.
Automation is a technique where one program exposes functionality to other programs. A program exposes functionality by exposing one or more OLE classes, including functions/procedures and properties. Other programs can then instantiate objects from those exposed classes, and make use of them in their program.
For example Word exposes several Automation classes that can be used to manipulate or create Word documents directly from other programs.
The purpose of Automation is in fact very similar to DDE, the big difference is that Automation is object oriented and fully supports encapsulation, inheritance and polymorphism, and of course that using Automation is a lot easier and more straight forward.
The program that exposes Automation classes is called an Automation server, and the program accessing exposed functionality is called an Automation Controller.
OLE Compound Documents gives one application the possibility to either link or embed an OLE object from another application into its own document, without having any knowledge of that object’s behavior.
For instance using OLE Compound Documents you can insert a picture from Paint into a Word document, without Word having any idea of how to display the picture. The picture is inserted as an OLE object instantiated from an OLE class in Paint, providing that the object itself is responsible for all drawing and rendering of its picture. Word simply tells the object to draw it self, without having any knowledge of what the object contains.
The embeddable or linked object’s application is called an OLE Compound Document server application, and the application embedding or linking the object is called an OLE container application.
You can import ActiveX Controls, Automation Libraries and Embedded (OLE Document) Objects in the Studio very easily, at which time the necessary "wrapper" classes are automatically created for you. See Importing COM Components for further information.