Creating And Using Com Objects; Connecting To Com Objects - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

Chapter 19: Using CFOBJECT to Invoke Component Objects

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.
331

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents