How to Make a VB6 OCX
1. Open VB6 software and select “ActiveX Control” from the list of new project templates. Click on “Project” from the top level Visual Basic menu. Select “Project1 Properties” from the drop-down list. In the “Project Name” box, replace the default name, “Project1” with a name relevant to your new control. Insert a brief description of what the control will do in the “Project Description” box and click “OK.”
2. Click on the “UserControl” window created in Step 1 to display the Properties window. Change the default name from “UserControl1” to something short that describes the new control. Do not include spaces in the name.
3. Add one of the existing controls shown in the ToolBox on the left to the renamed UserControl form by double-clicking the control. Find other controls to use as a model for your new ActiveX control by clicking on “Project” in the top menu and selecting “Components.” In the “Controls” tab, scroll down the list of controls until you see those beginning with “Microsoft.” Choose one of these and click the checkbox next to the name. To use non-Microsoft controls in the list you must license them from the provider, or you may choose to design completely new controls. Click “OK” to add the selected component to your project.
4. Click on “Add-Ins” in the top menu and then “VB6 ActiveX Ctrl Interface Wizard. Select “Loaded/Unloaded” in the “Load Behavior” section, then click “OK.” Repeat this process to add the “Property Page Wizard,” which helps create Property Pages for the new control.
5. Click on the “Add-Ins” menu again and choose “VB6 ActiveX Control Interface Wizard” to run the Wizard. Click “Next” on the wizard. The right-hand column on the next page lists some standard Property, Methods and Events used by most controls. Add any additional ones from the left column that seem useful. Click “Next” when done. Add any additional elements you need using the “Page Property Wizard.” In each case, keep clicking “Next” to work through additional modifications until “Finish” appears at the bottom, and then click on “Finish.”
6. Click “File” and “Save As,” and provide a location and name, which will have an automatic extension of ".ctl.” Create the OCX file by clicking “File” and selecting “Make [Project Name].OCX.”
0 comments:
Post a Comment