Writing .dll in C++ for VB6

333 Views Asked by At

I am trying to migrate a VB6-based .ocx into C++. The migration path that I'm settling on is as follows:

  1. Migrate the current .ocx into a regular COM .dll (it doesn't really have any user interface components, and I'm not sure why it's an .ocx anyway).
  2. Write a C++ version of the COM .dll, and use that as my replacement.

My questions are:

a. Does this seem like the right way to go?

b. How does one go about creating a COM .dll in C++ in Visual Studio 2010? I tried creating a simple .dll, using tlbexp to generate a .tlb file, but this doesn't seem to work. I can pull my .tlb into the VB5 project, but there are no classes to instantiate. If I try to use regsvr32 to register the .dll, I get the "no entry point" error.

I have seen references to an option in VS 2005 to "Register for COM Interop", but I haven't been able to find an equivalent option in VS 2010.

Thanks in advance for your help!

1

There are 1 best solutions below

1
On

You have to create an ATL project: enter image description here Then add the COM objects to your component. The missing entry point you receive is because astandard dll does not have the correct entry ppoints for registration, an ATL project does this for you.