CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    4

    How to create an Automation DLL?

    Hi, I'm having a bit of a problem here...I want to create a DLL in VB .NET and register it so that MBS Navision can execute the public functions of that class.

    It used to work fine. But all of a sudden I get errors in navision saying that it cannot create an instance of the automation class.

    I don't have any experience with creating DLL's so I found this on the Net and used it in my VB Project:

    Code:
    Imports System
    Imports System.Xml
    Imports System.Runtime.InteropServices
    Imports NETRONIC.XGantt
    
    Namespace cWrapper
    
        <Guid("89439AD1-756F-4f9c-BFB4-18236F63251E"), _
        InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
        Public Interface _cWrapper
            <DispId(1)> Function ScheduleShipment(ByVal fileLocation As String) As Integer
        End Interface
    
    
        <Guid("1376DE24-CC2D-46cb-8BF0-887A9CAF3014"), _
         ClassInterface(ClassInterfaceType.None), _
         ProgId("Wrapper.Numbers")> 
        Public Class cWrapper
            Implements _cWrapper
    
            Public Function ScheduleShipment(ByVal fileLocation As String) As Integer Implements _cWrapper.ScheduleShipment
                MessageBox.Show(fileLocation)
                ....
            End Function
    
      Public Sub New()
                MyBase.New()
            End Sub
    
        End Class
    
    End Namespace
    The DLL shows up in my registry after I register it. But I cannot create an instance of it. Anyone know what's wrong here? Or does anyone know a better way to create a DLL or OCX? So that I do not need to use the interface and all the <Guid("89439AD1-756F-4f9c-BFB4-18236F63251E"), _
    InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _ ....code ?

    Thanks in advance

  2. #2
    Join Date
    Sep 2005
    Posts
    4

    Re: How to create an Automation DLL?

    I looked for the Object in the Visual Basic 6 Ole View tool. When creating an instance there i get an error that says:

    IClassFactory::CreateInstance Failed

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

Featured