Creating Our visitors.dll File

Are you tired of using

Notepad.exe
to create the VBScript yet? Well, finally we can jump back to our familiar VB development environment and create a new DLL. Start a new project. This time we are going to create an ActiveX DLL file that will handle all of our database accesses.

Try It Out - Creating Our DLL

1.  Start a new project of ActiveX DLL type:

2.  Call our new project

visitor.vbp
and save it in
\Chapter13
. Name the DLL file
visitors.cls
. This will hold the code for us.

Our DLL will expose two functions to the outside world. And remember that functions look like methods to the outside world. The

setVisitor
function will add a new user to our database and the
getVisitor
function will retrieve information about existing users. Our DLL will have no visual face to the world, so there will be no forms. Just a DLL file with two functions. And remember we have to add the ADO references for our DLL to be able to access the components it needs.

3.  So now is a good time to add the ADO references to our file. Bring up the References dialog in your new project and add the references as shown in the screenshot:

Now we'll add the relevant methods to our DLL.

© 1998 by Wrox Press. All rights reserved.