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)
Syntax
'Declaration
Function AddItemFromFile ( _
pszFilename As String, _
pHierSource As IVsHierarchy, _
<OutAttribute> ByRef pfItemAdded As Integer _
) As Integer
'Usage
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
Parameters
- pszFilename
Type: System.String
[in]Full path of file to add to the Toolbox.
- pHierSource
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy
[in]Hierarchy that owns the source file. This value can be nulla null reference (Nothing in Visual Basic).
- 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.
Remarks
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.