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 ...
Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.