IVsToolbox.AddItemFromFile 方法

允许文件以编程方式添加到工具箱中。

命名空间:  Microsoft.VisualStudio.Shell.Interop
程序集:  Microsoft.VisualStudio.Shell.Interop(在 Microsoft.VisualStudio.Shell.Interop.dll 中)

语法

声明
Function AddItemFromFile ( _
    pszFilename As String, _
    pHierSource As IVsHierarchy, _
    <OutAttribute> ByRef pfItemAdded As Integer _
) As Integer
int AddItemFromFile(
    string pszFilename,
    IVsHierarchy pHierSource,
    out int pfItemAdded
)

参数

  • pszFilename
    类型:System.String
    [in]添加的文件的完整路径添加到工具箱中。
  • pfItemAdded
    类型:System.Int32%
    [out, retval] 如果 true, file was moved successfully 然后添加到工具箱。如果 false文件,然后尚未添加。

返回值

类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 vsshell.idl:

HRESULT IVsToolbox::AddItemFromFile(
   [in]LPCOLESTR pszFilename,
   [in]IVsHierarchy *pHierSource,
   [out,retval]BOOL *pfItemAdded
);

使用此方法,文件将添加到工具箱的有效选项。 此方法使 FileDropped 对任何已注册的 工具箱 数据提供程序,直到一个能够处理中指定的文件。

.NET Framework 安全性

请参见

参考

IVsToolbox 接口

Microsoft.VisualStudio.Shell.Interop 命名空间