CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] Why is DllRegisterServer entry point not found

  1. #1
    Join Date
    Dec 2010

    [RESOLVED] Why is DllRegisterServer entry point not found

    I need to create a COM-callable DLL using VB.NET 2010 that can be opened by a legacy VB6 application. I'm experimenting with a very simple demo example first. When I try to register the resulting DLL with regsvr32, it shows me this error:

    "DemoCounter.dll was loaded, but the DllRegisterServer entry point was not found. This file cannot be registered."

    Here are the steps I followed:

    1. Create new VB.Net project as a class library.
    2. Delete the class1.vb file it starts with.
    3. Add a new class from template "COM Class"
    4. Build the DLL and try to register it.

    The class has the GUIDs, the <COMCLASS ...> stuff, and has a checkmark in the "Register for COM Interop" checkbox of the project settings.

    What am I missing?

    Here is the code of the class:

    <ComClass(DemoCounter.ClassId, DemoCounter.InterfaceId, DemoCounter.EventsId)> _
    Public Class DemoCounter

    #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 = "ecb3813e-ee9a-46c3-9bd5-e708776b3f93"
    Public Const InterfaceId As String = "41912ac2-770a-4023-bfbb-d8e8842d3979"
    Public Const EventsId As String = "dbcd034b-7ab6-4c36-93ab-5e4b6012f340"
    #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()
    End Sub

    Private m_Counter As Long

    Public Property Counter() As Long
    Return m_Counter
    End Get
    Set(ByVal value As Long)
    m_Counter = value
    End Set
    End Property

    Public Sub Increment()
    m_Counter += 1
    End Sub

    Public Sub Decrement()
    m_Counter -= 1
    End Sub

    End Class

  2. #2
    Join Date
    Dec 2010

    Re: Why is DllRegisterServer entry point not found

    Never mind.

    I found this post elsewhere that explains the whole thing:

    Regsvr32 won't work it, but regasm will:
    1. On the development system, VS2010 takes care of the registration during the build.
    2. On other systems to which the DLL will be distributed, the regasm.exe tool must be used.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)