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
)
参数
- dwAddCompOperation
类型:Microsoft.VisualStudio.Shell.Interop.VSADDCOMPOPERATION
[in] 包含添加元素操作的双字。
- cComponents
类型:System.UInt32
[in] 绑定元素。
- rgpcsdComponents
类型:array<System.IntPtr[]
[in] 指定 rgpcsdComponents。
- hwndPickerDlg
类型:System.IntPtr
[in] 指定 hwndPickerDlg。
- pResult
类型:array<Microsoft.VisualStudio.Shell.Interop.VSADDCOMPRESULT[]
[out] 向结果对象的指针。
返回值
类型: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
);
AddComponent 从 ComponentSelectorDlg调用。 ,当组件选择器对话框关闭,在调用提供的 IVsComponentUser 接口的 AddComponent 方法。 ComponentSelectorDlg 将调用。
pResult 内容决定是否关闭对话框。 如果元素添加用户成功或移除,对话框将关闭。 如果元素添加操作失败,对话框仍然处于打开状态。
在 AddComponent 方法,可以在 rgpComponentData的 cComponents 计数循环,添加数据,并从 VSADDCOMPRESULT的结果。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。