Sdílet prostřednictvím


IVsToolbox2.AddItem2(IDataObject, TBXITEMINFO[], String, Guid) Method

Definition

Adds an item to the referenced Toolbox tab, specifying a package GUID.

public:
 int AddItem2(Microsoft::VisualStudio::OLE::Interop::IDataObject ^ pDO, cli::array <Microsoft::VisualStudio::Shell::Interop::TBXITEMINFO> ^ ptif, System::String ^ lpszTab, Guid % guidPkg);
public int AddItem2 (Microsoft.VisualStudio.OLE.Interop.IDataObject pDO, Microsoft.VisualStudio.Shell.Interop.TBXITEMINFO[] ptif, string lpszTab, ref Guid guidPkg);
abstract member AddItem2 : Microsoft.VisualStudio.OLE.Interop.IDataObject * Microsoft.VisualStudio.Shell.Interop.TBXITEMINFO[] * string * Guid -> int
Public Function AddItem2 (pDO As IDataObject, ptif As TBXITEMINFO(), lpszTab As String, ByRef guidPkg As Guid) As Integer

Parameters

pDO
IDataObject

[in] Data object to add to the Toolbox.

ptif
TBXITEMINFO[]

[in] Structure containing the item information to set for the data object. For a list of ptif values, see TBXITEMINFO.

lpszTab
String

[in] The localized name of the tab to add to the Toolbox. The localized name can be obtained from the invariant non-localized name by calling GetIDOfTab(String, String)

guidPkg
Guid

[in] GUID identifying the package adding the Toolbox item. Package GUID identifying your VSPackage.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsToolbox2::AddItem2(  
   [in]IDataObject* pDO,  
   [in]PTBXITEMINFO ptif,  
   [in]LPCOLESTR lpszTab,  
   [in]REFGUID guidPkg  
);  

The Toolbox uses the Package GUID to set the UI text for your Toolbox item. In the bstrText element of the TBXITEMINFO structure, you should specify a resource ID of the form "#number". This resource ID must then correspond to the UI string for the Toolbox item in your satellite DLL. The Toolbox persists the package GUID and resource ID for each Toolbox item. This enables it to reassign each Toolbox UI string in the event that the user changes the environment language (locale).

Applies to