Compartir a través de


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
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
)
abstract AddComponent : 
        dwAddCompOperation:VSADDCOMPOPERATION * 
        cComponents:uint32 * 
        rgpcsdComponents:IntPtr[] * 
        hwndPickerDlg:IntPtr * 
        pResult:VSADDCOMPRESULT[] byref -> int
function AddComponent(
    dwAddCompOperation : VSADDCOMPOPERATION, 
    cComponents : uint, 
    rgpcsdComponents : IntPtr[], 
    hwndPickerDlg : IntPtr, 
    pResult : VSADDCOMPRESULT[]
) : int

Parameters

  • cComponents
    Type: UInt32

    [in] Count of components.

  • rgpcsdComponents
    Type: array<IntPtr[]

    [in] Specifies rgpcsdComponents.

  • hwndPickerDlg
    Type: IntPtr

    [in] Specifies hwndPickerDlg.

Return Value

Type: 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

See Also

Reference

IVsComponentUser Interface

Microsoft.VisualStudio.Shell.Interop Namespace