Finalizing the ActiveX Component

All of the code for your ActiveX component is now complete. All you have left to do is to build a final compiled component. The final component will be an in-process ActiveX component that will be called by oleisapi.dll when the user submits a form.

Step 1

First you must establish your project as an in-process ActiveX component. Access the project's options by selecting Options from the Tools menu and clicking on the Project tab. In the Project tab, set the following properties:

Project Name Eventreg
StartMode OLE Server
Description OLEISAPI Event Registration Component

Figure 7-9 shows the settings made in the Project tab of the Options dialog box.

Figure 7-9.

The Project tab of the Options dialog box.

The StartMode property tells Visual Basic that this project is an ActiveX component. This will make the functionality of the application available to oleisapi.dll. This is a crucial part of the final development.

Step 2

Create a compiled in-process ActiveX component by selecting Make OLE DLL FILE from the File menu. Name your ActiveX component eventreg.dll, an\d save it in the \scripts\project2 folder you previously set up.

Step 3

For oleisapi.dll to locate eventreg.dll, eventreg.dll must be registered in the server's system Registry. If you created eventreg.dll on the Windows NT server itself, eventreg.dll will automatically be entered into the system Registry. If you created the eventreg.dll on a client computer, you will need to copy the component

to the Windows NT server and register it manually. If the component is not properly registered, it will not work.

To register eventreg.dll on the server, you will need a copy of the regsvr32.exe registration utility. The registration utility is typically found in the clisvr folder of any Visual Basic 4.0 32-bit installation. The registration utility can be executed from MS-DOS or from the Windows Run command with the following syntax:

drive:\path\regsvr32.exe drive:\path\mycomponent.dll 

For eventreg.dll, the line required for registration might look like this:

c:\vb4\clisvr\regsvr32.exe c:\inetsrv\scripts\project2\eventreg.dll 

If the registration is successful, you will see a message box indicating that eventreg.dll is properly registered. Figure 7-10 shows a sample of the message box.

Figure 7-10.

A message box confirming successful registration of eventreg.dll.

© 1996 by Scot Hillier. All rights reserved.