Compiling the control is straightforward, but before you compile you should decide whether the control should be compiled to native code or pseudocode (p-code). Native code executes faster, but p-code results in a smaller OCX file.
In the case of the Blinker control, the differences are minimal. Because the control relies on Timer events, execution speed isn't much of an issue and the difference between a native code OCX file and a p-code OCX file is only 5 kilobytes (KB).
Of course, even 5 KB can make a difference when you are downloading a control across the Internet. It's generally a good idea to use p-code for any controls you plan to use in Internet applications.
To set the compiler options and compile your control, follow these steps:
Once the control is compiled, Visual Basic automatically registers it on your machine. Registering the control adds it to the Components dialog box, as shown in Figure 6-5.
If your control is part of an application that you are distributing, the Package and Deployment Wizard will handle registering your control when the application is installed on other machines. If you are distributing your control without a setup program, you'll need to install the Visual Basic runtime DLL, MSCOMCT2.OCX, and BLINKER.OCX and then use the REGOCX32.EXE utility to register MSCOMCT2.OCX and BLINKER.OCX. REGOCX32.EXE is found in the \COMMON\TOOLS\VB\REGUTILS directory on the Visual Studio CD-ROM. The following command line registers the Blinker ActiveX control:
REGOCX32.EXE BLINKER.OCX
Figure 6-5. The Components dialog box, which lists all registered controls.