Creating and using COM objects
773
5
Ensure that the ColdFusion server is not running. To stop the ColdFusion server, open the
Services control panel, select ColdFusion MX application server, and click Stop. (In Windows
98 or Windows ME, select Stop ColdFusion MX from the ColdFusion MX Programs item on
the Start menu.)
6
Add your .class files to the ColdFusion Microsoft application Java stubs file by doing the
following:
a
In the Windows Command prompt, make the parent directory of the directory that
contains your class files your working directory. In this example, make c:\src your working
director by entering
cd ..
in the Command prompt from step 4.
b
Enter the following command:
jar -uvf
cf_root
\lib\msapps.jar
directoryName
\*.class
Where
cf_root
is the directory where ColdFusion MX is installed and
directoryName
is the
name of the directory that contains the class files. For the OutlookXP example, enter the
following line:
jar -uvf C:\CFusionMX\lib\msapps.jar outlookXP\*.class
7
Update the
cf_root
/lib/neo-comobjmap.xml file by appending your object definition to the list.
The object definition consists of the following lines:
<var name="
progID
">
<string>
PackageName.mainClass
</string>
</var>
Use the following values in these lines:
■
ProgID
The COM object’s ProgID, as displayed in the OLE/COM object viewer.
■
PackageName
The package name you specified in step 3c.
■
mainClass
The main class of the COM object. The main class contains the methods you
invoke. For many Microsoft applications, this class is Application. In general, the largest
class file created in step 4 is the main class.
For example, to add outlookXP to neo-comobjmap.xml, add the lines in bold text above the
</struct>
end tag:
<var name="access.application.9">
<string>coldfusion.runtime.com.com2java.access2k.Application</string>
</var>
<var name="outlook.application.10">
<string>outlookXP.Application</string>
</var>
</struct>
In this example,
outlook.application.10
is the ProgID of the Outlook COM object,
outlookXP
is the package name you specified in step 3c, and
Application
is the COM object’s main class.
8
Restart the ColdFusion server: Open the Services control panel, select ColdFusion MX
application server, and click the Start button.
9
After you have installed the stubs, you can delete the directory you created in step 2, including
all its contents.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......