IVsComponentUser.AddComponent 方法

用于通过环境添加用户指定的元素在 组件选择器 对话框添加到指定的项目。

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

语法

声明
Function AddComponent ( _
    dwAddCompOperation As VSADDCOMPOPERATION, _
    cComponents As UInteger, _
    rgpcsdComponents As IntPtr(), _
    hwndPickerDlg As IntPtr, _
    <OutAttribute> pResult As VSADDCOMPRESULT() _
) As Integer
int AddComponent(
    VSADDCOMPOPERATION dwAddCompOperation,
    uint cComponents,
    IntPtr[] rgpcsdComponents,
    IntPtr hwndPickerDlg,
    VSADDCOMPRESULT[] pResult
)

参数

  • rgpcsdComponents
    类型:array<System.IntPtr[]
    [in] 指定 rgpcsdComponents。
  • hwndPickerDlg
    类型:System.IntPtr
    [in] 指定 hwndPickerDlg。

返回值

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

备注

COM 签名

从 vsshell.idl:

HRESULT IVsComponentUser::AddComponent(
   [in] VSADDCOMPOPERATION dwAddCompOperation,
   [in] ULONG cComponents,
   [in, size_is(cComponents)] PVSCOMPONENTSELECTORDATA rgpcsdComponents[],
   [in] HWND hwndPickerDlg,
   [out, retval] VSADDCOMPRESULT *pResult
);

AddComponentComponentSelectorDlg调用。 ,当组件选择器对话框关闭,在调用提供的 IVsComponentUser 接口的 AddComponent 方法。 ComponentSelectorDlg 将调用。

pResult 内容决定是否关闭对话框。 如果元素添加用户成功或移除,对话框将关闭。 如果元素添加操作失败,对话框仍然处于打开状态。

AddComponent 方法,可以在 rgpComponentData的 cComponents 计数循环,添加数据,并从 VSADDCOMPRESULT的结果。

.NET Framework 安全性

请参见

参考

IVsComponentUser 接口

Microsoft.VisualStudio.Shell.Interop 命名空间