Share via


IVsToolbox2.AddItemFromFile2 Method

Adds an item to the Toolbox from a file, specifying a package GUID.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function AddItemFromFile2 ( _
    pszFilename As String, _
    pHierSource As IVsHierarchy, _
    ByRef guidPkg As Guid, _
    <OutAttribute> ByRef pfItemAdded As Integer _
) As Integer
int AddItemFromFile2(
    string pszFilename,
    IVsHierarchy pHierSource,
    ref Guid guidPkg,
    out int pfItemAdded
)
int AddItemFromFile2(
    [InAttribute] String^ pszFilename, 
    [InAttribute] IVsHierarchy^ pHierSource, 
    [InAttribute] Guid% guidPkg, 
    [OutAttribute] int% pfItemAdded
)
abstract AddItemFromFile2 : 
        pszFilename:string * 
        pHierSource:IVsHierarchy * 
        guidPkg:Guid byref * 
        pfItemAdded:int byref -> int
function AddItemFromFile2(
    pszFilename : String, 
    pHierSource : IVsHierarchy, 
    guidPkg : Guid, 
    pfItemAdded : int
) : int

Parameters

  • pszFilename
    Type: String

    [in] Name of the file containing the item to add to the Toolbox.

  • guidPkg
    Type: Guid%

    [in] Package GUID identifying your VSPackage.

  • pfItemAdded
    Type: Int32%

    [out, retval] If true, then the item was successfully added from the file to the Toolbox. If false, then the item was not added.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsToolbox2::AddItemFromFile2(
   [in]LPCOLESTR pszFilename,
   [in]IVsHierarchy *pHierSource,
   [in]REFGUID guidPkg,
   [out,retval]BOOL *pfItemAdded
);

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).

.NET Framework Security

See Also

Reference

IVsToolbox2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace