Link to home
Start Free TrialLog in
Avatar of ROBERT MECHLER
ROBERT MECHLERFlag for United States of America

asked on

VB6 calling COM DLL written in Visual Studio 2003

I'm learning COM DLL. Wrote a COM DLL to display a msgbox in Visual Studio 2003. Build successful. Wrote VB6 and added a reference to the TLB. Put a button and code suggested in the tutorial I was following. Created the EXE on the Desktop. Ran, Worked fine. The COM DLL was built under Visual Studio Projects directory under My Documents.

Moved the exe and TLB/DLL to another machine and received an error.

What steps are needed to move to another machine. Is it just a matter of making the COM DLL show up on a new machine in the exact same directory. Are there additional steps associated with installing the COM DLL on the new machine.
Thanks
Bob
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

You have to register the .dll
64bit .dll
regsrv32 file.dll
32bit dll
c:\windows\syswow64 regsvr32 c:\filename.dll
Avatar of ROBERT MECHLER

ASKER

Message: MyComDll was loaded but the dllRegisterServer entry point was not found.  

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

#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 = "4C0F052C-349F-4B17-B003-A4BB04DB920F"
    Public Const InterfaceId As String = "2F29C72E-A97B-4A6B-A361-96B24BC33E4C"
    Public Const EventsId As String = "9E4C5F24-F7D7-4C39-B520-9DE022D6893F"
#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 Sub DisplayMessage()
        MsgBox("Hello from My Com Class")
    End Sub

End Class

Open in new window

For VB6 to consume a Visual Studio 2003 COM DLL, is there COM visibility feature that has to be set to True?

Bob
Or is there a DLLMAIN function that has to be included?

Bob
ASKER CERTIFIED SOLUTION
Avatar of darbid73
darbid73
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Exactly the right information!

We have old programs and .NET 4.6 programs and somehow they need to work together till everything is on the same version. Since I've been programming since I was 33 in 1979, I've had a lot of challenges migrating and/or making things work together. In my world, you have to put food on the table and can't always convert everything at once, so this kind of help is so much appreciated. I've bookmarked the site mentioned for examples and will check there more often. My first program was for Greyhound Food Management and their attempt at managing the recipes at their restaurants in their bus terminals on a Radio Shack Model 1. Still have programs I support that used GW Basic. Those folks take 'If it ain't broked, don't pay for a new version" to the limit. Other newer customers insist on the latest 4.6.1 .NET Core and web services.  It's hard to find the kind of information I need. The programmers are all dying out!. Good day!