CreateObject: COM object

Description

The CreateObject function can create a Component Object Model (COM) object.

To create a COM object, you must provide this information:

For most objects, you can get this information from the OLEView utility.

Note:   On UNIX, this function does not support COM objects.

Return value

A COM object.

Syntax

CreateObject(type, class, context, serverName)  

Parameters

Parameter Description
type
Type of object to create.
  • com
  • corba
  • java
  • component
  • webservice
class
Component ProgID for the object to invoke
context
  • InProc
  • Local
  • Remote
serverName
Server name, using UNC or DNS convention, in one of these forms:
  • \\lanserver
  • lanserver
  • http://www.servername.com
  • www.servername.com
  • 127.0.0.1
If context = "remote", this parameter is required.

Usage

The following example creates the Windows Collaborative Data Objects (CDO) for NTS NewMail object to send mail. You would use this code within a cfscript tag.

Mailer = CreateObject("COM", "CDONTS.NewMail");

For more information, see Developing ColdFusion MX Applications with CFML.

Comments