ActiveX controls are a special type of ActiveX component. Therefore, most of
the ActiveX concepts discussed in Chapter 14, "Creating an Active Document,"
apply directly to the subject of ActiveX controls.
In particular, an ActiveX control has the following notable features of any ActiveX
Moreover, you can implement these custom-definable members of the ActiveX control
class in the same way that you implement customized members of other ActiveX components. Of course
there are special considerations for ActiveX control members (especially properties), and
we discuss the specifics of ActiveX control members in the rest of this chapter.
Standalone (OCX) ActiveX Controls
Just as you can distribute stand-alone compiled ActiveX components in the form of DLL
or EXE files, you can also distribute compiled ActiveX controls in separate OCX files to other
programmers and end users. An OCX is another type of DLL that lives in a host application.
To create an OCX file implementing one or more custom controls, you create a special
ActiveX control project containing the ActiveX components you wish to distribute. Each ActiveX
component will be implemented with source code in its own file (extension .CTL). When you follow
the steps to create an ActiveX control as described in the rest of this chapter, you then can compile
the project into an OCX.
ActiveX Controls in Other Projects
An ActiveX control can also form part of another VB project. In that case, you
would include the control's CTL file as part of a Standard EXE or ActiveX EXE or DLL
You might choose to implement an ActiveX control as part of another project
when the control's function is so specialized that it would never be used outside its host
You might also keep an ActiveX control inside other projects to prevent other
programmers from accessing it independently. You can also accomplish the goal of keeping
your control proprietary, however, by using a licensing scheme described in "Licensing
and Distributing Your ActiveX Control."
NOTE - Licensing Considerations for ActiveX Control Distribution
: If you plan to distribute your OCX file commercially to end users or
other programmers or if you plan to distribute the file to the public at large
over the Internet, you must also take into account the special licensing and distribution
considerations for ActiveX controls.