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: System.String[in] Name of the file containing the item to add to the Toolbox.
pHierSource
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy[in] Hierarchy containing the file. This parameter can be nulla null reference (Nothing in Visual Basic) if the file is not part of a project.
guidPkg
Type: System.Guid%[in] Package GUID identifying your VSPackage.
pfItemAdded
Type: System.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: 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 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
- 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.