First, we will create a project in VC++:
From the VC++ IDE menu choose File->New and activate the tabpage
"Projects". From the procets-list choose "ATL COM AppWizard". Give our
baby a name. I named our lib "MyLib". This will be the name of the
COM-DLL and will also be the name of the TypeLib as you will find it in
the VB references list.
After that, press "OK" and VC AppWizard
will create a ATL COM Project for us. ATL means Active Template Library
and consists of a set of C++ template classes that make implementing
COM objects and interfaces much easier.
the next step of the AppWizard choose "Dynamic Link Library(DLL)" as
servertype. This will generate a in-process COM-component for us, that
means, it will run in the same process environment as our VB
application. Our component will have dependencies to the "atl.dll"
which is stored in your windows/system folder. You need to redistribute
and register it if you want to install your app on another machine. You
could also enable "MFC"-support, but if you do this your component will
have dependencies to the mfc dlls too. We won't do this.
Now press "Finish" and after that "OK". Your project and the source files will be created.
Our project workspace will now look like this:
Forget about that functions, I will not explain them and you will not need them.