I haven't used the MSCTLCOM2.DTPicker.2 control yet, but I am fairly familiar with CF and COM. What problem do you run in to? Please be more specific so I can try to help.
First off, I am still learning coldfusion. The object is created, but it doesn't display. I guess I don't know how to initialize the object. Does this help at all?
I think I see the problem. Just putting the code to the calender control won't make it show up in your web page like it does in VB or C++. The <cfobject> tag gives you a way to invoke the methods of the control. I'm not familiar with the specific control but the only way you'll be able to make it show up is if the control has a function you can call that generates html to pass back to the browser. If it does, you would need to call the appropriate function, retrieve the results, and then use <cfoutput> to display the html code it generated.
Well, I guess I either have to find out which function to call, or find another calender control similar to this one. I am very familiar with this control in VB and I thought ColdFusion was 100% compatible with all MS COM objects. Maybe I'll buy a book that explains COM objects a little better. Any suggestions on books?
Cossiboon, I am not sure it is really necessary for the COM object to be able to generate some HTML. However you do it, the COM object won't instantiate unless you connect to it. I think you might wanna try the following code, although I am not familiar with the control you're talking about:
<!--- Try to connect to the Word application object --->
<CFTRY>
<!--- If it exists, connect to it --->
<CFOBJECT
ACTION="CONNECT"
CLASS="MSComCtl2.DTPicker.2"
NAME="objCalendar"
TYPE="COM">
<CFCATCH>
<!--- The object doesn't exist, so create it --->
<CFOBJECT
ACTION="CREATE"
CLASS="MSComCtl2.DTPicker.2"
NAME="objCalendar"
TYPE="COM">
</CFCATCH>
</CFTRY>
Then, within a block of CFSCRIPT, you should be able to use some of the methods and properties of the object. Fictious example:
Invalid parser construct found on line 23 at position 4. ColdFusion was looking at the following text:
objMonths
Invalid expression format. The usual cause is an error in the expression structure.
The last successfully parsed CFML construct was a CFSCRIPT tag occupying document position (21:1) to (21:10).
By the way, don't take the above code literally, I don't know what the properties and methods are of your component, but I just posted the code as an example on how to work with COM objects in CF. Good luck!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.