IVsToolboxDataProvider2.GetItemID(IDataObject, String) Method

Definition

Used by the environment to retrieve and saves the canonical ID for the given Toolbox tab when a user selects the export option from the Import/Export Settings feature available on the IDE’s Tools menu.

public:
 int GetItemID(Microsoft::VisualStudio::OLE::Interop::IDataObject ^ pDO, [Runtime::InteropServices::Out] System::String ^ % pbstrID);
int GetItemID(Microsoft::VisualStudio::OLE::Interop::IDataObject const & pDO, [Runtime::InteropServices::Out] std::wstring const & & pbstrID);
public int GetItemID (Microsoft.VisualStudio.OLE.Interop.IDataObject pDO, out string pbstrID);
abstract member GetItemID : Microsoft.VisualStudio.OLE.Interop.IDataObject * string -> int
Public Function GetItemID (pDO As IDataObject, ByRef pbstrID As String) As Integer

Parameters

pDO
IDataObject

[in] The data object corresponding to the Toolbox item.

pbstrID
String

[out] The locale-invariant canonical ID of the Toolbox tab.

Returns

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

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsToolboxDataProvider2::GetItemID(  
   [in] IDataObject *pDO,  
   [out] BSTR *pbstrID  
);  

The environment calls IVsToolboxDataProvider2.GetItemID when a user chooses the export option of the IDE's Import/Export Settings feature.

On settings import, the environment will retrieve that ID an pass it to the ReconstituteItem method to recreate the Toolbox item.

The canonical ID, returned as pbstrID, is different from the localizable tab name defined when AddTab is called.

While, canonical tab names are required to be unique, localized strings change depending on the locale under which the IDE is running.

Therefore, the canonical ID must be locale-invariant.

There are no particular restrictions on the format of the canonical ID string, a GUID might be used, or an easy to remembered string in the language of the developer could be employed.

Any VSPackage that creates a Toolbox tab should call the SetIDOfTab.

Applies to