IVsToolbox2::AddItemFromFile2 Method (String^, IVsHierarchy^, Guid, Int32)
Adds an item to the Toolbox from a file, specifying a package GUID.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int AddItemFromFile2( String^ pszFilename, IVsHierarchy^ pHierSource, [InAttribute] Guid% guidPkg, [OutAttribute] int% pfItemAdded )
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 null 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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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).