User Guide
370 Chapter 20 Using cfobject to Invoke Component Objects
Calling nested objects
The current release of ColdFusion does not support nested (scoped) object calls. For
example, if an object method returns another object and you must invoke a property
or method on that object, use the following syntax:
<cfset objX = myObj.X>
<cfset prop = objX.Property>
(The syntax <cfset prop = myObj.X.Property> fails.)
Getting Started with COM/DCOM
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.
Requirements for COM
To make use of COM components in your ColdFusion application, you need at least
the following items:
• Microsoft OLE/COM Object Viewer, available from Microsoft at http://
www.microsoft.com/com/resources/oleview.asp. This tool is handy for viewing
registered COM objects.
• The COM objects, which are typically DLL or EXE files, that you want to use in
your ColdFusion application pages. These components should allow late
binding, that is, they should implement the IDispatch interface. 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.