ProjectNode.AddComponent Method

Notifies the project that a component reference has been added to the project.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

'宣言
Public Overridable Function AddComponent ( _
    dwAddCompOperation As VSADDCOMPOPERATION, _
    cComponents As UInteger, _
    rgpcsdComponents As IntPtr(), _
    hwndDialog As IntPtr, _
    pResult As VSADDCOMPRESULT() _
) As Integer
'使用
Dim instance As ProjectNode
Dim dwAddCompOperation As VSADDCOMPOPERATION
Dim cComponents As UInteger
Dim rgpcsdComponents As IntPtr()
Dim hwndDialog As IntPtr
Dim pResult As VSADDCOMPRESULT()
Dim returnValue As Integer

returnValue = instance.AddComponent(dwAddCompOperation, _
    cComponents, rgpcsdComponents, hwndDialog, _
    pResult)
public virtual int AddComponent(
    VSADDCOMPOPERATION dwAddCompOperation,
    uint cComponents,
    IntPtr[] rgpcsdComponents,
    IntPtr hwndDialog,
    VSADDCOMPRESULT[] pResult
)
public:
virtual int AddComponent(
    VSADDCOMPOPERATION dwAddCompOperation, 
    unsigned int cComponents, 
    array<IntPtr>^ rgpcsdComponents, 
    IntPtr hwndDialog, 
    array<VSADDCOMPRESULT>^ pResult
)
public function AddComponent(
    dwAddCompOperation : VSADDCOMPOPERATION, 
    cComponents : uint, 
    rgpcsdComponents : IntPtr[], 
    hwndDialog : IntPtr, 
    pResult : VSADDCOMPRESULT[]
) : int

Parameters

  • cComponents
    Type: System.UInt32

    The number of components in the rgpcsdComponents array.

  • rgpcsdComponents
    Type: []

    An array of pointers to VSCOMPONENTSELECTORDATA structures representing the selected components.

  • hwndDialog
    Type: System.IntPtr

    A pointer to the dialog box. Not used, pass in a null reference (Nothing in Visual Basic).

  • pResult
    Type: []

    An array of results.

Return Value

Type: System.Int32

E_NOTIMPL if there is no reference container, meaning that the project does not support references; otherwise S_OK.

Implements

IVsComponentUser.AddComponent(VSADDCOMPOPERATION, UInt32, [], IntPtr, [])

Remarks

This method is a callback from the IVsComponentSelector dialog when a new component has been selected.

If attempting to add one of the selected components causes a BadImageFormatException to be thrown (i.e. the class library or executable file is invalid), this method will display a message box with the exception's message.

Permissions

See Also

Reference

ProjectNode Class

ProjectNode Members

Microsoft.VisualStudio.Package Namespace