IVsToolbox2::AddItemFromFile Method (String^, IVsHierarchy^, Int32)

 

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)

int AddItemFromFile(
	String^ pszFilename,
	IVsHierarchy^ pHierSource,
	[OutAttribute] int% pfItemAdded
)

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 null.

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.

From vsshell.idl:

HRESULT IVsToolbox2::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.

Return to top
Show: