Results 1 to 6 of 6

Thread: ActiveX dll and ASP query

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Location
    Cambridge, England
    Posts
    14

    ActiveX dll and ASP query

    Hello!
    I've created a simple ActiveX dll in VB6 to put into my ASP page.
    using this tutorial http://www.4guysfromrolla.com/webtech/040300-1.shtml

    My query is ...do I have to make any special settings on my main web server as it's coming up 'Page cannot be displayed'.
    I think the problem is that it cannot connect to the com object as normal asp's work fine.
    It also works perfectly on my own pc running IIS 5.1.
    Thank you !

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    What does your ASP code look like? How is the object being created? How are you calling it? How is the page being written out? Has the object bee properly registered on the server?
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Location
    Cambridge, England
    Posts
    14
    ASP is....
    <%
    Dim oCheckYear 'Create an object for the component
    Dim IsLeapYear 'Create a string to hold the result
    Dim Year 'Create a var to hold the year

    Year = 1900 'You can cahnge this number to any year
    'you want, keep the years 4 digits though

    'Create an instance of the Component we just wrote
    Set oCheckYear = CreateObject("CheckYear.LeapYear")

    'Call the IsLeapYear function in our component, and
    'store the result
    IsLeapYear = oCheckYear.IsLeapYear(Year)

    'Close the instance, good programming practice
    Set oCheckYear = Nothing
    %>
    <HTML>
    <HEAD>
    <TITLE>The world population</TITLE>
    </HEAD>
    <BODY>
    <%
    'Let the user know
    If IsLeapYear = True Then
    Response.Write "<P>The year <b>" & Year & "</b> is a leap year.</P>"
    Else
    Response.Write "<P>The year <b>" & Year & "</b> is not a leap year.</P>"
    End If
    %>
    </BODY>
    </HTML>

    I created the ActiveX Dll in VB 6 and clicked File -> Make dll and created it on the web server form there - is that the same as registering it?

  4. #4
    Fanatic Member
    Join Date
    Feb 2003
    Location
    Los Angeles, CA
    Posts
    681
    if you created it and compiled with vb, it should have registered itself, but just to make sure, give it one more try. the next thing to do though is to add a reference to your dll in your iis project. go project > references in your visual interdev and pick up your dll (you should see a line added in the global.asa file after that).

  5. #5
    Junior Member
    Join Date
    Aug 2001
    Location
    Cali
    Posts
    21

    Dll Problem

    I am having a similar problem...

    I read your solution to make a reference in the Global.asa file, but I don't use InterDev and I'm not sure how to. I use a text editor for my scripts. I did try to make a reference manually by putting the following at the top of my global.asa file:

    <!-- METADATA TYPE="TypeLib"
    file="Dll_Path" -->

    Where Dll_Path is the actual file path of my Dll file.

    But it still does not work I. I get the following error when I run a script that tries to use CreateObject of the DLL:
    Microsoft VBScript runtime (0x800A01AD)
    ActiveX component can't create object

    If I run the script while my IDE for the DLL is running, it works fine, and I can even debug the code once the class is created.

    I'm really stuck here, thanks in advance for any help.

    Stodolos

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by radum
    if you created it and compiled with vb, it should have registered itself,
    That depends if he compiled it on his machine, but created the file on the server.... it gets registered on the PC the compiled it....
    and created it on the web server form there
    I suspect this is what he did.
    To fix, copy the dll to the server (or not, since it sounds like it already there), then run (on the server, not from your PC) Regsrv32 "Path_to_the_Dll\Dll_name.dll"
    That will register it on the server.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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