Getting Started with COM Components  
 
 

An important thing to keep in mind when working with COM objects in ColdFusion is that the components you use with ColdFusion are non-visual - that is, they don't have a graphical interface. They are server-side components that encapsulate business logic you can invoke in your ColdFusion applications. If you were to invoke an object with a graphical interface in your ColdFusion application, a window for the component might appear on the web server desktop, not the user's desktop. And each time the component was invoked, another window would open until server resources were exhausted.

COM objects used by ColdFusion are dynamically linked components. Late binding means that the component is not linked into ColdFusion until it's actually needed. If you want to change a component on a live site, you just have to make sure no one is using it, and it's free to be swapped out with a new version.

COM objects can be transparently relocated on a network. A component on a different machine on a network is treated the same as a component on the local system. Components can also be referenced on machines outside the local network by using DCOM.

 
 
  Getting set up: COM  
 
 

To make use of COM components in your ColdFusion application, you need at least the following items:

  • The Microsoft COM/OLE Viewer, available (last time we checked) at http://www.microsoft.com/oledev/olecom/oleview.htm, is a handy tool you can use to view COM/OLE object interfaces.
  • The COM objects you want to use in your ColdFusion application pages. These are typically DLLs or EXEs. These components should allow late binding, that is, implement the IDispatch interface. The COM/OLE Viewer from Microsoft allows you to view the component interface so that you can properly define the CLASS attribute for the CFOBJECT tag and the properties and methods for the object, in lieu of adequate documentation.
 
 
  Register the object  
 
 

Once you've acquired the object you want to use, you may need to register it with Windows NT in order for ColdFusion (or anything else) to find it. Some objects may be deployed with their own setup programs that register objects automatically, while others may require the use of the Windows NT regsvr32 utility. You can invoke regsvr32.exe either from a command prompt (a.k.a. DOS box) or using the NT Run command, in the following form:

regsvr32 c:\path\filename.dll
 
 
  Find the component ProgID and methods  
 
 

Your COM object should provide documentation explaining each of the component's methods and the ProgID. With this information, you're ready to work with the CFOBJECT tag. If you don't have documentation, use the COM/OLE Viewer to view the component's interface. The COM/ OLE Viewer will tell you all you need to know about the component's interface.



 
 
BackUp LevelNext
 
 

allaire     AllaireDoc@allaire.com
    Copyright © 1998, Allaire Corporation. All rights reserved.