Freigeben über


Visual Basic Concepts

What is an Add-In?

You can use the Visual Basic extensibility object model to ease development through add-ins. Add-ins are tools that you create programmatically using objects and collections in the extensibility model to customize and extend the Visual Basic environment. In a sense, add-ins "snap on" to the Visual Basic integrated development environment (IDE).

Whether created in Visual Basic or Visual C++, the primary goal of an add-in is to enable you to automate something in the development environment that is difficult, or tedious and time-consuming to accomplish manually. Add-ins are time- and labor-saving automation tools for the Visual Basic programming environment.

Note   When using C++ to develop add-ins, whenever you get a pointer from Visual Basic using Automation, you must call "release" when you are finished using it. Visual Basic follows the standard reference counting rules. For example, when you get a pointer out of Visual Basic by calling _NewEnum, you must call release through that pointer. Also, when you use pDispatch = m_ourMenuItems.Item(pszCaption), you must also use pDispatch->Release().

There are four types of add-ins: add-ins, Wizards, utilities, and builders.

  • Add-in is the generic term for a program you create that performs task(s) within the IDE, often in response to certain events (such as a mouse click or a form opening). Its actions may or may not be visible to the user.

  • A Wizard is a special type of add-in which leads a user step-by-step through a task, often an especially complex or tricky one. Although they can be constructed any way you like, Microsoft implements its Wizards in a specific manner. A Microsoft Wizard consists of a number of frames, each frame containing an image in the upper left corner, a label description to the right of the image which may also contain instructions, and an optional area near the bottom in which other controls (such as ListBox or CommandButton controls) can be placed. To help you create Wizards, we've included an add-in called the Wizard Manager.

    For more information about wizards, see "Wizards and the Wizard Manager" in "How to Build an Add-In."

  • A utility is an add-in, sometimes a rather large one, which doesn't necessarily require Visual Basic to run. This means that it is compiled as an ActiveX executable, but it retains the ability to also be called as an add-in in the Visual Basic IDE. VisData is an example of a utility.

  • A builder is a type of add-in which helps a user to view or set properties of a control, or properties that several controls have in common. However, builders aren't normally created as add-ins anymore because Visual Basic gives you many builder-like capabilities at design time through the PropertyPage object.

How to Build an Add-In" discusses the specifics of creating these add-in variants.

Most add-ins that you've seen or used before were probably visually-based; that is, they appeared as commands in menus or as buttons on toolbars in the Visual Basic IDE. Now, add-ins don't necessarily have to be visible — they can sit hidden in the background and respond to events such as the sizing of a form or control. Or they may be invisible and do something like reset a timer control when a certain project loads, or they may be entirely visual; for example they may size a group of like objects by sizing only one of the objects.