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


Function AddItemFromFile ( _
    pszFilename As String, _
    pHierSource As IVsHierarchy, _
    <OutAttribute> ByRef pfItemAdded As Integer _
) As Integer
‘사용 방법
Dim instance As IVsToolbox
Dim pszFilename As String
Dim pHierSource As IVsHierarchy
Dim pfItemAdded As Integer
Dim returnValue As Integer

returnValue = instance.AddItemFromFile(pszFilename, _
    pHierSource, pfItemAdded)
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


  • pszFilename
    Type: System.String
    [in]Full path of file to add to the Toolbox.
  • pfItemAdded
    Type: System.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: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.


COM Signature

From vsshell.idl:

HRESULT IVsToolbox::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


IVsToolbox Interface

IVsToolbox Members

Microsoft.VisualStudio.Shell.Interop Namespace