Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Files with Coldfusion 2

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
I have got the need to run a bit of code that is written in Visual Basic through a website. This bit of code can be compiled into an EXE format if required, or run from a module in Access. Is there anyway with coldfusion that I can set a CF page to run this code and for it to return a value from the executable file/access module ??
 
Yes, you just need to compile your VB code into an ocx and make any functions or variables public which will be referenced from CF. Once you do this, you'll need to register your ocx on the server with regsvr32.exe. This is a simple process and just involves supplying the name of your ocx to regsvr32. Once it's registered, you can call functions and read/write variables vi the <cfobject> tag.

Hope this helps,
GJ
 
Good suggestion GunJack. I'd like to add that if you would like to know mote about <CFOBJECT> and COM, you should check out Good luck!

<webguru>iqof188</webguru>
 
Thanks for the help I will give it a go and see how far I get. Cheers
 
Right I have registered the ocx file(regsvr reported sucessful on completion) now I am trying to write the code that will access this file. I am using the example from Allaire of the order of:

<CFOBJECT TYPE=&quot;COM&quot; ACTION=&quot;CREATE&quot; CLASS=&quot;Allaire.GP_Unlock&quot; NAME=&quot;obj&quot;>

When i run this page it reports an error saying that I have an invalid class string. I have used a help file from cfcomet (cheers igof188) and that said to use a program called OLEView to find the class name of the file. Do you actually know where this information will be stored within OLEView as there is a lot of information in there ??
 
I just dug up an old .ocx and ran through it so I believe this is accurate. In Oleviewer, go to Object Classes -> All Objects and then select your ocx from the list. On the right, you should see a lot of information under the &quot;Registry&quot; tab. Look down the side for a heading called &quot;AppID&quot;. It should read something like this:

AppID
{34kdfsd89834 ..... } = myOcxName.Name

The &quot;myOcxName.Name&quot; is the paramter you would use for the class parameter. I seem to recall that this corresponds to &quot;ProjectName.ControlName&quot; in your Visual Basic project.

Let me know if you have any trouble,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top