O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with COM

The Component Object Model (COM) is a Microsoft-sponsored specification for creating distributed software components.[1] There are a large number of third-party COM objects, most of which can be used by ColdFusion. COM is supported only in the Windows version of ColdFusion.[2]

The cfobject tag can call COM objects located on the same machine as the ColdFusion server or on other machines connected to the network. cfobject can also communicate with objects residing anywhere on the network using Distributed COM (or DCOM). In order to connect to a COM object using ColdFusion, the object must first be registered. You register a COM object using the regsvr32 command from the Windows command line, as in:

C:\> regsvr32 myobject.dll

Once a COM object is registered, you can connect to it using ColdFusion. To understand how to use the cfobject tag to communicate with a COM object, you first need to understand the tag’s syntax:

<cfobject type="COM"
          name="name"
          class="progID"
          action="action"
          context="context"
          server="server_name">

When connecting to a COM object, the type attribute must always be set to COM. The name attribute is required and specifies a name for the object to be used when referencing the object’s attributes and methods in your code. class is a required attribute and specifies the program ID for the object you want to invoke. If you don’t know the program ID for your object, consult the object’s documentation. You can also use Microsoft’s OLEView program to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required