Results 1 to 4 of 4

Thread: DLLs and ASP

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    70
    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?

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    70
    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
    %>

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width