Home
Up
Visual Basic
Visual C++

Visual Basic

Creating Barlist Add-in Components in Visual Basic is very easy. Installing the component is another story. This chapter will give step by step instructions for creating and installing Barlist Add-in components created with Visual Basic.

Creating a Barlist Add-in Project

To create a Barlist Add-in Project, start the Visual Basic Development Environment. If the New Project dialog is not displayed at startup select New Project from the File menu. Select the New tab and double click on the WSDOT Barlist Add-in template. This will create a new Barlist Add-in project with a Barlist Add-in component.

Figure 1 New Project Dialog

Implementing the Add-in

Implementing your Barlist Add-in is fairly simple. The MenuItem property supplies the text that will appear on the Add-in menu of the Barlist program. Just replace the text supplied by the code generator with an appropriate string. The Go method can do what ever you like.

Installing the Add-in

Now comes the hard part, installing your Add-in component. The source of the problem is the Barlist Add-in Component Category. All Barlist Add-in components must register themselves as a member of the Barlist Add-in Component Category in order for the Barlist program to use them. The easiest way to accomplish this is to augment the registration process every ActiveX DLL implements. However, to the best of our knowledge, Visual Basic does not allow developers to augment the ActiveX DLL registration process (If you know differently, please let us know). We are forced to register Barlist Add-in Components manually.

Fortunately, REG files make life easier. These files contain registry settings and are imported into the system registry by double clicking on them. To register Barlist Add-in Components we are going to use a REG file.

Before we can register the Barlist Add-in Component we need two things. The Class Identifier (CLSID) for the Add-in and a REG file for the Add-in.

Finding the CLSID

The easiest way to find the CLSID (at least the easiest way I know) is to look for it in the registry. First, build the DLL by selecting Make from the File menu. This will register the DLL with the system (remember that this registration is incomplete for our needs). Now, from the Start Button, select Run and type in REGEDIT.EXE and press the OK button. This starts the Registry Editor.

Figure 2 Registry Editor

From the Menu, select Find. Search for MyAddin.BarlistAddin. If you change the name of the Project or the Class Module, search for project.class. In the MyAddin.BarlistAddin folder, you will find a folder called CLSID. Select it. In the right-hand pane, you will see an entry called "Default". The Data associated with Default is the CLSID. Copy this big long ugly case sensitive string.

Figure 3 CLSID for MyAddin.BarlistAddin

Creating the REG file

Next we have to create a REG file. The Barlist Add-in Developers Kit comes with a template for the REG file you need. It is found in the installation directory and is called BarlistAddinReg.tpl. Make a copy of this file and rename the copy to filename.reg. Using a text editor like Notepad, open the REG file. Where you see the text <<Your CLSID goes here>>, put your CLSID. The CLSID should include the braces ({}) and the pointy characters (<< and >>) should be removed.

Figure 4 REG File template.

Save your changes to this file and exit.

Updating the Registry

The last step is the easiest. Just double click on your REG file and the registration of your component should be complete. You will want to distribute your REG file to your users. You can either have your installer import the REG file into the registry, or you can have your users do it manually by double clicking on it.


Copyright © 1999, Washington State Department of Transportation