Udostępnij za pośrednictwem


IVsToolbox.AddItemFromFile(String, IVsHierarchy, Int32) Method

Definition

Allows files to be programmatically added to the Toolbox.

public:
 int AddItemFromFile(System::String ^ pszFilename, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHierSource, [Runtime::InteropServices::Out] int % pfItemAdded);
int AddItemFromFile(std::wstring const & pszFilename, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHierSource, [Runtime::InteropServices::Out] int & pfItemAdded);
public int AddItemFromFile (string pszFilename, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHierSource, out int pfItemAdded);
abstract member AddItemFromFile : string * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * int -> int
Public Function AddItemFromFile (pszFilename As String, pHierSource As IVsHierarchy, ByRef pfItemAdded As Integer) As Integer

Parameters

pszFilename
String

[in] Full path of file to add to the Toolbox.

pHierSource
IVsHierarchy

[in] Hierarchy that owns the source file. This value can be null.

pfItemAdded
Int32

[out, retval] If true, then the file was successfully added to the Toolbox. If false, then the file 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 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.

Applies to