![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 357](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369357.webp)
Chapter 19: Using CFOBJECT to Invoke Component Objects
331
Creating and Using COM Objects
In the following example, an SMTP mail handling component is created using
CFOBJECT.
<CFOBJECT ACTION=CREATE
NAME=MAILER
CLASS=SMTP.Mailer>
The component needs to be created by ColdFusion before any methods in the
component can be invoked or properties assigned in your application pages. This
sample SMTP component includes a number of methods and properties to perform a
wide range of mail handling tasks.. In the OLE/COM Viewer, methods and properties
may be grouped together, making it a little confusing at first to determine one from the
other.
Our SMTP mail component includes properties such as:
Screen
User
FullName
FromName
FromAddress
You use these properties to define elements of the mail message you want to send. The
SMTP Mailer component also includes a number of methods, such as:
SendMail
AddRecipient
AddCC
AddAttachment
Connecting to COM objects
There are essentially two ways, specified with the ACTION attribute of CFOBJECT, to
connect to COM objects using CFOBJECT:
•
The Create method (CFOBJECT ACTION="Create"), which takes a COM object,
typically a DLL, and instantiates it prior to invoking methods and assigning
properties.
•
The Connect method (CFOBJECT ACTION="Connect"), which links to an
object that is already running on the server, typically an executable.
In addition to specifying which way to connect to a COM object, you also have to
specify the following with the CONTEXT attribute:
•
INPROC — This means an In-Process server object (typically a DLL) that is
running in the same process space as the calling process, such as ColdFusion.
•
LOCAL — This is an Out-of-Process server object (typically an EXE) that is
running outside the ColdFusion process space but running locally on the same
server.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...