PDA

Click to See Complete Forum and Search --> : DLLs and ASP


rlb_wpg
Nov 1st, 2000, 03:54 PM
I create a dll using VB6 where a number
of variables are passed with 3 string values being
passed ByRef to a public function.
(ie.
public function MyFunction(byVal var1 as lng,
byval var2 as bln, byRef var3 as string,
byRef var4 as string, byRef var5 as string)
as boolean
)
A recordset is opened and the values, along with
HTML tags, are added to these 3 strings.

On my asp page I get the values from the previous form.
Pass these values to the function and then print the 3
string variables.

I tested the dll with another VB6 application to make sure
the strings were formatted correctly.

I put the dll in the same directory as my asp page, included
the file in the asp code.
(ie.
<% OPTION EXPLICIT %>
<!-- #include file="CreateCallRpt.dll" -->
)

But, when I run the page I receive an entire page like:
MZ@ !L!This program cannot be run in DOS mode. $QU0 U0 U0 ,T0 f`fDfnMf^fU f(Ef
...



What am I doing wrong?

monte96
Nov 2nd, 2000, 09:16 AM
Your including a binary file as HTML/ASP.

You need to register the dll on the PC that is running your IIS server, then call it like this:

Dim objMyDll

Set objMyDll = Server.CreateObject("DllName.ClassName")

Then you can use it's methods and properties.

rlb_wpg
Nov 2nd, 2000, 11:36 AM
Thanks,
I will try registering the DLL properly.

As for the object:
My DLL doesn't not contain any object only one public
function (and numerous private ones).
So I don't actually create an object, I only call the public
function found within.

ie.
<!-- #include file="CreateCallRpt.dll" -->
<%
dim blnStatus, lngVar1, blnVar2, strVar3
dim strVar4, strVar5

lngVar1 = 1
blnVar2 = FALSE

blnStatus = MyFunction(lngVar1, blnVar2, strVar3,
strVar4, strVar5)

response.write strVar3
response.write strVar4
response.write strVar5
%>

monte96
Nov 2nd, 2000, 01:40 PM
You can't create an ActiveX dll without a class. VB adds it for you when you choose an ActiveX dll project type.

You maybe just didn't realize it, but your one function *IS* inside of a class. One which you will need to verify the name (although I would suspect 'Class1' since that is the default)

And you DO create an object because your dll is an object that just happens to have only one public method. You can't just include it and use it's methods without creating an instance of the object first.