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!

CFM + dll /exe interaction? 1

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

Is it possible, and how ;-) to interact with a DLL or exe file on the server?

I explain:

Page1.cfm includes a form with e.g. 1 field called: 'FEE'.

I want this information [value of the text input field FEE] to be submitted to 'calculate.dll or calculate.exe'
[= form action=calculate.dll -> ?]

This will have to do all the necesarry calculations and return a value.

How do I catch this value? I suppose the DLL will have call a URL like: page2.cfm?results=x


Any idea?
Do I have to use custom tags or register the dll/exe component or is that not necessary?

Any help welcome.
Bram




 
I had do do something like this a while ago, we had a bundle of code made by a client that was compiled into an ocx format, this i then registered with the server and was then able to call using CFOBJECT

<!---Make the object in CF--->
<CFOBJECT TYPE=&quot;COM&quot; ACTION=&quot;CREATE&quot; CLASS=&quot;name of registered file&quot; NAME=&quot;obj&quot;>

<!--- Calls the external Function to create the key --->
<CFSET key = obj.functionname(Passed Variables)>

the function (DLL/OCX) needs to be written to return the values that you want to use in CF, these are just accessed in the normal #value_coming_back# manner.

Hope this helps

there were a few articles that i read that i will try and dig out if you need more help !
 
Hi arperry

First of all, tnx very much for the (fast) response !

It would be very nice of you if you would find those articles again. I'm very sorry but it's not very clear to me yet ;-( or ;-)

I explain:
You write:

<!---Make the object in CF--->
<CFOBJECT TYPE=&quot;COM&quot; ACTION=&quot;CREATE&quot; CLASS=&quot;name of registered file&quot; NAME=&quot;obj&quot;>

What does it mean? CLASS= name of registered file, I suppose I have to register the 'thing' [dll/exe] somewhere?

Do I have to include this code everytime someone does a page request?

<CFSET key = obj.functionname(Passed Variables)>
This is 'chinese' to me, sorry ;-)

Key is a name you used?
obj.functionname(passed variables)
what do I have to copy? I mean: do I have to copy 'obj' or does it refer to something?

Lots of questions, I know ;-)


With kind regards
Bram
 
right you need to have the dll/ocx file on the server and then register this with the server using the regsvr32 command in a command promot window, for instruction on how to use regsvr32 type regsvr32 /?

this will then do something (can't quite remember what it does with it) with the code that you have got, I think that it copies it to a system drive

if your ocx/dll file has been created correctly (I will be a bit vauge here as this was all done by the client - it was their code that we were using) it will have a name assigned to it when it is regestered with the server (quite how this is done in the file i am not sure!!) but this is the name that you use in the below code to reference the object, and CF that this is the object that i want to use

<CFOBJECT TYPE=&quot;COM&quot; ACTION=&quot;CREATE&quot; CLASS=&quot;name of registered file&quot; NAME=&quot;obj&quot;>

to use the function that you have got in the registered file you do something like this:

<CFSET key = obj.functionname(Passed Variables)>

obj, is the name that we have assigned for CF to use when accessing the registered file, it can be anything. functionname is the name of the function within the registered file that you want to access - this is the actual name of the function. and passed variables is where you need to put the variables that you want to pass across to that function, these are in the normal CF way #variable1#, #variable2#

so the whole thing would look like:

<!---Define the object--->
<CFOBJECT TYPE=&quot;COM&quot; ACTION=&quot;CREATE&quot; CLASS=&quot;UnlockKey.UnlockKey&quot; NAME=&quot;obj&quot;>

<CFSET myVariable = obj.CreateUnlockKey(#variables.PCode#,#variables.key_date#,#variables.rand#)>

the value from the function will be returned, and placed into myVariable, which is a CF variable so we can manipulate it is whatever way we want to then.

Something that I should have mentioned earlier really, I think that CFOBJECT only works on a window platform, but don't quote me on that one !

Hope this makes a bit more sence.

Sorry, I can't actually find the links to sites at the moment, not at the right computer and won't be for a week or so. I think that one was off the top of my head. You could also look on your server at this page, put your server name in front!

cfdocs/CFML_Language_Reference/2_ColdFusion_Tags/lr2_058.htm


Hope this will help you understand !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top