SetAddInInfo Method

Home Page (Objects)OverviewFAQReference

Applies to: Application object

Provides Developer Studio with information about an add-in, when the add-in is loaded. The add-in calls SetAddInInfo.

Syntax

object**.SetAddInInfoHinstance,CmdDispatch,BitmapResourceMedium,BitmapResourceLarge,**cookie

Parameters

object

An expression that evaluates to an Application object. When you use the SetAddInInfo method of the Application object, you can omit object because the name of the Application object is implied when you access its properties and methods.

Hinstance

The HINSTANCE of the add-in's DLL, casted to a Long. If you create the add-in using Visual Basic, you can access this with the App object App.HInstance.

CmdDispatch

The pointer to the dispatch interface (dispinterface) implemented by the add-in's Commands object. When a user chooses one of the add-in's commands, Developer Studio invokes the command by using this pointer to communicate with the add-in.

BitmapResourceMedium

A Long that is the ID of the bitmap resource containing medium-sized images of all toolbar buttons that the add-in is adding. Specify -1 if the add-in does not provide toolbar buttons.

BitmapResourceLarge

A Long that is the ID of the bitmap resource containing large-sized images of all toolbar buttons that the add-in is adding. Specify -1 if the add-in does not provide toolbar buttons.

cookie

A Long that is the cookie identifying the add-in. Developer Studio passes this value to the add-in through the add-in's OnConnection method.

Remarks

Only add-ins can call the SetAddInInfo method. VBSscript macros cannot.

Example

The following example, which is written in Visual C++, is the code automatically generated when you create an add-in using the Developer Studio Add-in Wizard:

STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
      long dwCookie, VARIANT_BOOL* OnConnection)
{
...
   pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
      (LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie);
...
}

See Also   AddCommand method, AddCommandBarButton method, AddKeybinding method, EnableModeless method.