IVsToolbox2.AddItemFromFile2(String, IVsHierarchy, Guid, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an item to the Toolbox from a file, specifying a package GUID.
public:
int AddItemFromFile2(System::String ^ pszFilename, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHierSource, Guid % guidPkg, [Runtime::InteropServices::Out] int % pfItemAdded);
public int AddItemFromFile2 (string pszFilename, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHierSource, ref Guid guidPkg, out int pfItemAdded);
abstract member AddItemFromFile2 : string * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * Guid * int -> int
Public Function AddItemFromFile2 (pszFilename As String, pHierSource As IVsHierarchy, ByRef guidPkg As Guid, ByRef pfItemAdded As Integer) As Integer
Parameters
- pszFilename
- String
[in] Name of the file containing the item to add to the Toolbox.
- pHierSource
- IVsHierarchy
[in] Hierarchy containing the file. This parameter can be null
if the file is not part of a project.
- guidPkg
- Guid
[in] Package GUID identifying your VSPackage.
- pfItemAdded
- 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.
Returns
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).