Share via


IVsToolbox2.AddItemFromFile Method

Allows files to be programmatically added to the Toolbox.

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

Syntax

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

Parameters

  • pszFilename
    Type: String

    [in]Full path of file to add to the Toolbox.

  • pfItemAdded
    Type: Int32%

    [out, retval] If true, then the file was successfully added to the Toolbox. If false, then the file 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::AddItemFromFile(
   [in]LPCOLESTR pszFilename,
   [in]IVsHierarchy *pHierSource,
   [out,retval]BOOL *pfItemAdded
);

Using this method, the file is added to the active tab of the Toolbox. This method causes FileDropped to be called on all of the registered Toolbox data providers until one is able to handle the specified file.

.NET Framework Security

See Also

Reference

IVsToolbox2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace