The first step in creating the LISTER.OCX is to use Visual C++'s ControlWizard to create a skeleton version of all the support files we'll need, just as AppWizard creates skeletal support files for EXE programs. To create LISTER, select the New item in Visual C++'s File menu and then select Project Workspace. Next, select the OLE ControlWizard option, as shown in Figure 9.1.
Figure 9.1 Visual C++'s ControlWizard.
We'll base the LISTER control on the standard List Box control so that we'll have all the functionality of a listbox. (But note that you need not base your custom control on any preexisting control type.) In ClassWizard's step 2 box, select LISTBOX as the type of control our control should subclass, as shown in Figure 9.2.
Figure 9.2 ControlWizard's Control Options box.
This selection indicates to ControlWizard that we want to base our new control on the listbox type. Now click OK in the Control Options box and Finish in ControlWizard to create the support files for LISTER.OCX.
At this point, ControlWizard creates the new project, including these important files:
Let's take a moment to examine some of the files created by ControlWizard.