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 result in further Web server requests not 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 make use of COM components in your ColdFusion application, you need at least the following items:
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 the object you want to use, you must register it with Windows in order for ColdFusion (or any other program) to find it. Some objects might be deployed with their own setup programs that register objects automatically, while others might require manual registration.
You can register Inproc object servers (*.dll, *.ocx) manually by running the regsvr32.exe utility using the following form:
regsvr32 c:\path\servername.dll
You typically register local servers (*.exe) either by starting them or specifying a command line parameters, such as the following:
C:\pathname\servername.exe -register
Your COM object should provide documentation explaining each of the component's methods and the ProgID. With this information, you are ready to use the cfobject
tag. If you do not have documentation, use the 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.
After have install a COM object, make sure you register it using the regsvr32.exe utility. Otherwise, you cannot find the object in the Object Viewer. 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 the COM object you want to use. The Object Viewer also gives you access to options for the operation of the object.
If you view the TypeInfo, you see the object's methods and properties. Some objects do not have access to the TypeInfo area. This is determined when an object is built and by the language used.