W
Wake-Up-Jeff
I am trying to create a VB.Net COM DLL which I can use in VBScript.
I followed the steps in the following article:
http://msdn2.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx
(I used the method "with COM class template")
My DLL got created fine (I guess) - no errors in build process.
The "Make Assembly COM-Visible" checkbox is checked.
I then created a vbscript which tried to create an instance of the object:
i.e.
set obj = CreateObject("Test")
However, I always receive the error
"ActiveX can't create object 'Test'"
I tried registering the DLL by using regasm, but still got the error.
Can anyone advise what I am missing?
Sample code for the VB.Net app follows:
<ComClass(Test.ClassId, Test.InterfaceId, Test.EventsId)> _
Public Class Test
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "7d75a31e-3ef9-4b31-9647-1e0f6d3729de"
Public Const InterfaceId As String =
"f19ce7ce-b85f-4d59-a187-c8e3fc9cb67b"
Public Const EventsId As String = "105f085a-2e06-4958-9de2-5aa642f966fc"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Function Add(ByVal i1 As Integer, ByVal i2 As Integer) As Integer
Add = i1 + i2
End Function
End Class
I followed the steps in the following article:
http://msdn2.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx
(I used the method "with COM class template")
My DLL got created fine (I guess) - no errors in build process.
The "Make Assembly COM-Visible" checkbox is checked.
I then created a vbscript which tried to create an instance of the object:
i.e.
set obj = CreateObject("Test")
However, I always receive the error
"ActiveX can't create object 'Test'"
I tried registering the DLL by using regasm, but still got the error.
Can anyone advise what I am missing?
Sample code for the VB.Net app follows:
<ComClass(Test.ClassId, Test.InterfaceId, Test.EventsId)> _
Public Class Test
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "7d75a31e-3ef9-4b31-9647-1e0f6d3729de"
Public Const InterfaceId As String =
"f19ce7ce-b85f-4d59-a187-c8e3fc9cb67b"
Public Const EventsId As String = "105f085a-2e06-4958-9de2-5aa642f966fc"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Function Add(ByVal i1 As Integer, ByVal i2 As Integer) As Integer
Add = i1 + i2
End Function
End Class