Skip to main content
Inspiring
August 4, 2006
Question

Attributes of cfobject >> class

  • August 4, 2006
  • 5 replies
  • 640 views
I'm a newbie, learning to understand the concept of object oriented programming with cfobject. Can anyone help me with one of attribute of cfobject called : class?
In the documentation it says that: Class >> is required >> Enter the component ProgID for the object you want to invoke.
I'm embarass to say that I don't understand what it mean by : Enter the component ProgID for the object you want to invoke ?????

If I want to create a test template like the "hello world" using cfobject and class attribute (Note:I have to use class attributes of the cfobject because once I understand this attribute I will need to use it in my next assignment)
what am I supposed to write in my Hello World test template? is this one line enough? what should I write in class attribute and how do I know if the object has been instantiated? please help!

<cfobject type="COM" name="Testting" class="???????????" action="CREATE">

I'm using cfmx 6, and I'm testing out of my dev. server
This topic has been closed for replies.

5 replies

Participant
May 20, 2008
Is there a way to return the word count of a Microsoft Word document using the inbuilt COM object methods?
mega_LAuthor
Inspiring
August 7, 2006
I googled cfobject when I found this url. Mr. Keller posted some examples in a zip (I've downloaded successfully) and this is exactly what I need. Unfortunately, I tested his codes and I got error message.
First I run index.cfm then click on Hello World link.

In his helloworld.cfm he run cfobject where the error is pointing to and I haven't been able to successfully find the answer why the cfobject is not working.

Responses from my original posting help me understand about the basic of using cfobject but this error still confuses me.

Below is the error and the error is pointing to the cfobject line 5 which is:
<cfobject type="COM" name="oPDF" class="PDFlib_com.PDF" action="CREATE">

Error Occurred While Processing Request
An exception occurred when instantiating a Com object.
The cause of this exception was that: coldfusion.runtime.com.ComObjectInstantiationException: An exception occurred when instantiating a Com object..

The error occurred in \\jhu\arg\myfolder\helloworld.cfm: line 5
Called from \\jhu\arg\myfolder\helloworld.cfm: line 5
Called from \\jhu\arg\myfolder\helloworld.cfm: line 5

3 : <!--- class attribute is Required. The component ProgID for the object to invoke. --->
4 : <!--- This cfobject gives error when instantiating the com object but the cfscript gaves a successful result --->
5 : <cfobject type="COM" name="oPDF" class="PDFlib_com.PDF" action="CREATE">
6 :
7 : <!--- <CFSCRIPT>






Inspiring
August 4, 2006
<cfobject is one of those multi-faced tags. It has different forms that
require different parameters. It has forms for COM, component, COBRA,
Java|EJB and web service objects.


Dan Bracuk wrote:
> I didn't realize the class attribute was required. Maybe the docs you wrote
> were inaccurate since this line of code has been working for us for quite some
> time.
>
> <cfobject component="GetVisits" name="TheseVisits">
>
>
Inspiring
August 4, 2006
I didn't realize the class attribute was required. Maybe the docs you wrote were inaccurate since this line of code has been working for us for quite some time.

<cfobject component="GetVisits" name="TheseVisits">
Inspiring
August 4, 2006
You wouldn't be using a <cfobject type="com" ...> to connect to a
ColdFusion template you created. You would be using it to connect to
COM [Component Object Model] objects see:
http://www.microsoft.com/com/default.mspx.

Now if you created your Hello world as a ColdFusion Component.

helloWorld.cfc
--------------
<component>
<cffunction name="SayHi" output="false" returnType="string">
<cfreturn "Hello World">
</cffunction>
</component>

You could then use the <cfobject type="component"...> form to access the
ColdFusion component in an object type manner.

testCFobject.cfm
----------------

<cfobject name="anObj" component="helloWorld">

<cfoutput>#anObj.sayHi()#</cfoutput>


mega_L wrote:
> I'm a newbie, learning to understand the concept of object oriented programming
> with cfobject. Can anyone help me with one of attribute of cfobject called :
> class?
> In the documentation it says that: Class >> is required >> Enter the
> component ProgID for the object you want to invoke.
> I'm embarass to say that I don't understand what it mean by : Enter the
> component ProgID for the object you want to invoke ?????
>
> If I want to create a test template like the "hello world" using cfobject and
> class attribute (Note:I have to use class attributes of the cfobject because
> once I understand this attribute I will need to use it in my next assignment)
> what am I supposed to write in my Hello World test template? is this one line
> enough? what should I write in class attribute and how do I know if the object
> has been instantiated? please help!
>
> <cfobject type="COM" name="Testting" class="???????????" action="CREATE">
>
>