Lets you create and use Component Object Model (COM) objects. With this tag, you can invoke any automation server object type registered on a computer. You can use a utility like Microsoft's OLEView to browse COM objects.
OLEView, and information about COM and DCOM, can be found at Microsoft's OLE Development web site http://www.microsoft.com/oledev/
.
To use cfobject
, you must provide the object's program ID or filename, the methods and properties available through the IDispatch interface, and the arguments and return types of the object's methods. The OLEView utility can give you this information for most COM objects.
<cfobject type = "COM" action = "action" class = "program_ID" name = "text" context = "context" server = "server_name">
cfcollection,
cfexecute,
cfgraph,
cfindex,
cfreport,
cfsearch,
cfservlet,
cfwddx
<html> <head> <title>cfobject (COM) Example</title> </head> <body> <H3>cfobject (COM) Example</H3> <!--- Create a COM object as an inproc server (DLL). (class = prog-id) ---> <cfobject action = "Create" type = "COM" class = Allaire.DocEx1.1 name = "obj"> <!--- Call a method. Note that methods that expect no arguments should be called using empty parenthesis. ---> <cfset obj.Init()> <!--- This object is a collection object, and should support at a minimum: Property : Count Method : Item(inarg, outarg) and a special property called _NewEnum ---> <cfoutput> This object has #obj.Count# items. <BR> <HR> </cfoutput> <!--- Get the 3rd object in the collection. ---> <cfset emp = obj.Item(3)> <cfoutput> The last name in the third item is #emp.lastname#. <BR> <HR> </cfoutput> <!---Loop over all the objects in the collection.---> <P>Looping through all items in the collection: <BR> <cfloop collection = #obj# item = file2> <cfoutput> Last name: #file2.lastname# <BR> </cfoutput> </cfloop> ... </body> </html>