IVsComponentUser.AddComponent Method
Used by the environment to add components specified by the user in the Component Selector dialog to the specified project.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function AddComponent ( _
dwAddCompOperation As VSADDCOMPOPERATION, _
cComponents As UInteger, _
rgpcsdComponents As IntPtr(), _
hwndPickerDlg As IntPtr, _
<OutAttribute> pResult As VSADDCOMPRESULT() _
) As Integer
'Usage
Dim instance As IVsComponentUser
Dim dwAddCompOperation As VSADDCOMPOPERATION
Dim cComponents As UInteger
Dim rgpcsdComponents As IntPtr()
Dim hwndPickerDlg As IntPtr
Dim pResult As VSADDCOMPRESULT()
Dim returnValue As Integer
returnValue = instance.AddComponent(dwAddCompOperation, _
cComponents, rgpcsdComponents, hwndPickerDlg, _
pResult)
int AddComponent(
VSADDCOMPOPERATION dwAddCompOperation,
uint cComponents,
IntPtr[] rgpcsdComponents,
IntPtr hwndPickerDlg,
VSADDCOMPRESULT[] pResult
)
int AddComponent(
[InAttribute] VSADDCOMPOPERATION dwAddCompOperation,
[InAttribute] unsigned int cComponents,
[InAttribute] array<IntPtr>^ rgpcsdComponents,
[InAttribute] IntPtr hwndPickerDlg,
[OutAttribute] array<VSADDCOMPRESULT>^ pResult
)
function AddComponent(
dwAddCompOperation : VSADDCOMPOPERATION,
cComponents : uint,
rgpcsdComponents : IntPtr[],
hwndPickerDlg : IntPtr,
pResult : VSADDCOMPRESULT[]
) : int
Parameters
dwAddCompOperation
Type: Microsoft.VisualStudio.Shell.Interop.VSADDCOMPOPERATION[in] Double word containing the add component operation.
cComponents
Type: System.UInt32[in] Count of components.
rgpcsdComponents
Type: array<System.IntPtr[][in] Specifies rgpcsdComponents.
hwndPickerDlg
Type: System.IntPtr[in] Specifies hwndPickerDlg.
pResult
Type: array<Microsoft.VisualStudio.Shell.Interop.VSADDCOMPRESULT[][out] Pointer to a result object.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From 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 is called back from ComponentSelectorDlg. The AddComponent method of the IVsComponentUser interface provided in the call to ComponentSelectorDlg will be invoked when the component selector dialog is dismissed.
The contents of pResult determine whether the dialog closes. If the component add succeeds or is cancelled by the user, the dialog is closed. If the component add operation fails, the dialog remains open.
In the AddComponent method, you loop on the cComponents count for rgpComponentData, add the data, and return the result from VSADDCOMPRESULT.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.