Creating an About Box

 < Free Open Study > 



Step 7 will normally allow you to create an About box for your add-in. Although I discuss this briefly, the Add-in Wizard in the initial release version of Visual Studio .NET ignores this option. Even if you select the option, the wizard will not create the About box. In reality, you will probably want to create your own About box somewhere other than in the Connect class, which is the only real code module that the wizard creates for you.

The window for Step 7 (shown in Figure 2-7) prompts you to create an About box for your add-in that displays version information, support information, licensing information, and so forth. If you don't want to create an About box for your add-in, leave the check box unchecked and click the Next button. Because the wizard won't create the code for the About box I bypass this step.

click to expand
Figure 2-7: Creating an About box

Viewing a Summary of Options Selected

Click the Next button to proceed to the last step in the Add-in Wizard, where you are shown a summary of the options you have selected for your new add-in. Figure 2-8 displays this summary.

click to expand
Figure 2-8: Summary of selected options

The page in Figure 2-8 summarizes the choices you've made for constructing your add-in. All of the options that you specified in the earlier panels are listed here, including the following:

  • Programming language

  • Application host(s)

  • Whether the add-in appears as a command on the Tools menu

  • Add-in load options

  • Add-in availability

  • Whether the add-in is command line safe

If any of these options are not what you meant to select, you may click the Back button and correct them. Note that any step that you "back" over will have to be redone. After you correct the incorrect option(s), click the Next button until you return to the Summary screen, and then click Finish to create the add-in.

Once the Add-in Wizard has generated the new add-in, it is placed in the directory you selected in the New Projects dialog box (see Figure 2-1).

Automatic Registration of Your Add-in

The Add-in Wizard automatically performs registration for you. The add-in shows up in your registry with the key hierarchy, as shown in Figure 2-9.

click to expand
Figure 2-9: Registry entry for your add-in

Directory Hierarchy Created by the Wizard

In addition to registering your add-in when you click the Finish button in the final step of the wizard, the project and the solution setup will be saved in a rather complex directory structure, as shown in Figure 2-10.

click to expand
Figure 2-10: Directory hierarchy

The wizard creates an entry in the registry, which causes Visual Studio .NET to list your add-in in the Add-in Manager dialog box. For those of you who wrote add-ins in an earlier version of Visual Basic, the add-ins used to be listed in VBADDINS.INI. In Visual Studio .NET, they are listed in the registry, in the structure previously shown in Figure 2-9.

The root directory, E:\VSProjs\MyAddinTest1, contains the entire set of project items, including the code modules, project file, solution setup project, and other miscellaneous items. Table 2-1 describes some files that are of most interest to you at this stage of development.

Table 2-1: Description of Main Files Created by the Wizard

FILE

DESCRIPTION

Connect.vb

The Connect class contains the code for connecting and disconnecting the add-in.

MyAddinTest1.vbproj

Project file for the add-in (corresponds to .vbp in Visual Basic 6.0).

MyAddinTest1.sln

Solution setup project (new in .NET) used in installation of the add-in.

Manually Connecting with the Add-in Manager

On the Tools menu in the IDE is an entry for the Add-in Manager. If you click that menu item, the Add-in Manager dialog box displays, as shown in Figure 2-11.

click to expand
Figure 2-11: Add-in Manager dialog box

The Add-in Manager presents the dialog box shown in Figure 2-11 for loading and unloading add-ins. The dialog box also allows the user to dictate add-in load behavior. Once the dialog box is displayed, it lists all currently registered add-ins. You can set the following options:

  • You can have the add-in load immediately or load when the environment (in this case, the Visual Studio IDE) starts.

  • Optionally, you can have the add-in load only when the environment is started through the command line, such as a build operation.

Loading an Add-in Immediately

Select this option by checking the check box to the left of the desired add-in. Click the check box in the Startup column, and then click OK. Because your add-in has a user interface, it will appear on the Tools menu when you click OK. Because your add-in has a message box coded in the OnConnection method, it will display the "On Connection" message as it is loaded. If you attempt to load an add-in that cannot be either located or loaded, the IDE will ask if you would like to remove the add-in from its list of registered add-ins. If you respond positively, the add-in will be removed from the registry, and it will no longer be listed in the Add-in Manager dialog box.

Loading an Add-in at (Next) Environment Start-up

Select the add-in from the list, but do not check the box to the left of the desired add-in. Check the check box in the Startup column. The next time the IDE starts, the add-in will load if it is available.

Options in the Add-in Manager Dialog Box

You can experiment with the options in the Add-in Manager dialog box to see what happens in the registry. For example, open Regedit and go down to the registry entry for your add-in, as shown in Figure 2-9. Unchecking the Startup check box in the Add-in Manager dialog box causes the LoadBehavior to change to (0). Checking it causes the LoadBehavior in the ProdID Registry entry to change to (1).

MyAddinTest1 Displayed in the Add-in Manager Dialog Box

As you can see, the Add-in Wizard has added your add-in to the list of available add-ins. This dialog box is only slightly different from the Visual Basic 6.0 Add-in Manager dialog box. In .NET, add-ins can be run from a command line. Because you did not select the option that would allow you to run from the command line, that check box is not checked. The dialog box shows that you want your add-in loaded when the .NET IDE loads.



 < Free Open Study > 



Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net