Posted on 2000-03-30
I have written an ActiveX DLL in VB to return some data from the registry. When I ran the DLL in the VB IDE and attached to it from an ASP page I had no problems. Once I compiled the DLL and tried to attach to it from an ASP page it acts as if the Class_Initialize() routine is not being executed. The results come back with a Count of -1. I am also able to get correct results when I create a new VB project and reference this DLL.
The class code is below
Private mvarCount As Long 'local copy
Private mvarNames As Variant 'local copy
Private mvarLocations() As Variant 'local copy
Private Sub Class_Initialize()
Dim Count As Long
mvarNames = EnumRegKeyValues(HKEY_LOCAL_MACHINE, "Software\tcg\avisoft\modules")
mvarCount = UBound(mvarNames) - 1
For Count = 0 To UBound(mvarNames)
mvarLocations(Count) = ReadRegValue(HKEY_LOCAL_MACHINE, "Software\tcg\avisoft\modules", CStr(mvarNames(Count)))
Public Function GetModuleName(Index As Variant) As Variant
If CLng(Index) <= UBound(mvarNames) Then
GetModuleName = mvarNames(CLng(Index))
GetModuleName = ""
And here is the ASP code
<% Response.Buffer = True %>
<title> ASP Test </title>
Testing Active X Object<br>
Set obj = Server.CreateObject("ASReg.Registry")
Response.Write "obj.Count = " & obj.Count & "<br><br>"
For Count = 0 To obj.Count
Response.Write "Count is " & Count & "<br>"
Response.Write "Module Name is: " & obj.GetModuleName(Count) & "<br>"
Response.Write "Module Location is: " & obj.GetModuleLocation(Count) & "<br><br>"
Does anyone have some insight that they can share on this?