1
votes

I hope I am placing my question in right place. I could not find closer tags.

I am setting up a new 64 bit system to have everything from my old 32 bit system on it.

I used vb6 to create an activeX dll test project to make a testProj.dll, package it and install it by running the setup.exe of the package as administrator.

My test project is called testProj having a class called testClass which has a simple sub called testSub as follows:

Public Sub testSub()
    Response.Write “--------- testSub is called ----------“
End Sub

The testSub simply prints a message to confirm that the sub was called.

I successfully install / register the testProj.dll and on an asp page I successfully call the Server.CreateObject(“testProj.testClass”) to instantiate the testProj for calling its testSub().

On Error Resume Next

Dim testObj
Set testObj  =  Server.CreateObject(“testProj.testClass”)


if err.number <> 0 then
    Response.write "1----------err.number = " & err.number & "--------- err.description = " & err.description
    err.clear
end if


Call testObj.testSub()


if err.number <> 0 then
    Response.write "2----------err.number = " & err.number & "--------- err.description = " & err.description
    err.clear
end if


Set testObj = nothing

But the code generates error with no description:

2----------err.number = -2147164123 ---------err. description = 

Also if I comment out the 'Call testObj.testSub()' I do not get any error. Meaning that the source of the error is the call to testSub().

I run everything as administrator so I do not expect any permission issue. Could an expert tell me what the problem might be?

Thank you

1
To Decode 0x8004nnnn Errors HResults with facility code 4 means the HResult contains OLE errors (0x0 to 0x1ff) while the rest of the range (0x200 onwards) is component specific errors so 20e from one component will have a different meaning to 20e from another component. This is why the source of the error is extra important for errors above 0x80040200. Put -2147164123 into Calc and it shows 0xffffffff8004E025. So a component raised the error and didn't set the description. What is the error source?CatCat
This was posted a few days ago on Stack Overflow before the OP removed after suggesting it was a duplicate, a lot of useful comments where lost.user692942
That error is 0x8004E025 in the Windows API this refers to COM+ Activation failed because an initialization function failed. Check the event log for more information.. So your COM DLL is failing to initialise with the COM+ subsystem. The duplicate as previously stated provides an abundance of information to help diagnose these types of problems.user692942
How do you expect the DLL to know what Response is? That is a Classic ASP specific object which in a VB6 DLL won't exist hence as @jww points out leads to an Object Required error because it doesn't know what Response is.user692942

1 Answers

0
votes

It looks like you are assuming that you have access to the Classic ASP context from inside the COM DLL which will not be the case. The code is failing inside the COM DLL because it doesn't know what Response is which will trigger an Object Required error inside the DLL bubbling up to the Classic ASP page.

The simplest solution is to change what the method is sending back. As you can't call the Response.Write() method directly the next best thing is to return a string instead then use Response.Write() from the ASP page to display it.

Modify the COM DLL method to return a String;

Public Function testSub() As String
  testSub = "--------- testSub is called ----------"
End Function

Then in the ASP page;

Call Response.Write(testObj.testSub())