Wrtining a COM DLL in either VC6 or 7

Posted on 2003-03-28
Medium Priority
Last Modified: 2013-12-14
I have an application that was written in VC6 with MFC support.  It consists of a .exe user interface dialog and two dialog app DLL's that get called from the .exe that runs under NT4.0.  I now have to port the app. to 2000 and replace the VC++ .exe user interface with a VB .NET front end.  Since the original .exe passes data structures to the DLL's I wanted to replace this functionality of passing data structure parameters functionality by compiling the DLL's as type libraries so the VB .NET front end could call the functions as if they exist in the VB .NET app.  This is done by adding a reference to the VB project and it works fine using VB6.  When moving to the VB .NET environment however the DLL's it appears have to be COM compliant DLL's in order to be Added as a reference to the VB .NET project.
I don't have the foggiest idea how to create a COM DLL as there is no option in the DLL wizard that includes COM support in VC6 and I have no real experience with VC7 to know if it is a built for DLL's.
Question by:johnsla
LVL 10

Accepted Solution

makerp earned 500 total points
ID: 8230017
i think that what you need to do is use VC++ and create an ATL application (its listed in the new -> projects dialog). You can then create wrapper classes to wrap you existing code.. i have done this in the past to make old C style stuff availble to VB script etc.

once you have created the project you can create a number of simple objects which are basic COM objects that can be created in VB Script, .Net etc. to do this right click on the project in class view and select new ATL object.

each object will be abstracted by a C++ class, you can add methods to this using the wizards (right click on the class in question, add method etc). if you now what you are doing you can side step the wizards but you will have to create all the IDL code etc yourself if you do this. the wizards add entries to the IDL files for you so its quick and easy.

before going mad and porting code i would write a simple one that has a single method that say returns a number just to test the principle

Expert Comment

ID: 9566413
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: makerp

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question