ColdFusion is an automation (late-binding) COM client. As a result, the COM object must support the IDispatch interface, and arguments for methods and properties must be standard automation types. Because ColdFusion is a typeless language, it uses the object's type information to correctly set up the arguments on call invocations. Any ambiguity in the object's data types can lead to unexpected behavior.
In ColdFusion, you should only use server-side COM objects, which do not have a graphical user interface. If your ColdFusion application invokes an object with a graphical interface in a window, the component might appear on the web server desktop, not on the user's desktop. This can take up ColdFusion Server threads and prevent further web server requests from being serviced.
ColdFusion can call Inproc, Local, or Remote COM objects. The attributes specified in the cfobject
tag determine which type of object is called.
To use COM components in your ColdFusion application, you need at least the following items:
Object Viewer lets you view an object's class information so that you can properly define the class
attribute for the cfobject
tag. It also displays the object's supported interfaces, so you can discover the properties and methods (for the IDispatch interface) of the object.
After you acquire an object, you must register it with Windows for ColdFusion (or any other program) to find it. Some objects have setup programs that register objects automatically, while others require manual registration.
You can register Inproc object servers (.dll or .ocx files) manually by running the regsvr32.exe utility using the following form:
regsvr32 c:\path\servername.dll
You typically register Local servers (.exe files) either by starting them or by specifying a command line parameters, such as the following:
C:\pathname\servername.exe -register
Your COM object supplier should provide documentation that explains each of the component's methods and the ProgID. If you do not have documentation, use the OLE/COM Object Viewer to view the component's interface.
The OLE/COM Object Viewer installation installs the executable, by default, as \mstools\bin\oleview.exe. You use the Object Viewer to retrieve a COM object's Program ID, as well as its methods and properties.
To find an object in the Object Viewer, it must be registered, as described in "Registering the object". The Object Viewer retrieves all COM objects and controls from the Registry, and presents the information in a simple format, sorted into groups for easy viewing.
By selecting the category and then the component, you can see the Program ID of a COM object. The Object Viewer also provides access to options for the operation of the object.
If you view the TypeInfo, you see the object's methods and properties, as shown in the following figure. Some objects do not have access to the TypeInfo area, which is determined when an object is built and by the language used.