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.
Содержание ColdFusion MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...