Partilhar via


IVsComponentUser.AddComponent Method

Definition

Used by the environment to add components specified by the user in the Component Selector dialog to the specified project.

public:
 int AddComponent(Microsoft::VisualStudio::Shell::Interop::VSADDCOMPOPERATION dwAddCompOperation, System::UInt32 cComponents, cli::array <IntPtr> ^ rgpcsdComponents, IntPtr hwndPickerDlg, cli::array <Microsoft::VisualStudio::Shell::Interop::VSADDCOMPRESULT> ^ pResult);
public int AddComponent (Microsoft.VisualStudio.Shell.Interop.VSADDCOMPOPERATION dwAddCompOperation, uint cComponents, IntPtr[] rgpcsdComponents, IntPtr hwndPickerDlg, Microsoft.VisualStudio.Shell.Interop.VSADDCOMPRESULT[] pResult);
abstract member AddComponent : Microsoft.VisualStudio.Shell.Interop.VSADDCOMPOPERATION * uint32 * nativeint[] * nativeint * Microsoft.VisualStudio.Shell.Interop.VSADDCOMPRESULT[] -> int
Public Function AddComponent (dwAddCompOperation As VSADDCOMPOPERATION, cComponents As UInteger, rgpcsdComponents As IntPtr(), hwndPickerDlg As IntPtr, pResult As VSADDCOMPRESULT()) As Integer

Parameters

dwAddCompOperation
VSADDCOMPOPERATION

[in] Double word containing the add component operation.

cComponents
UInt32

[in] Count of components.

rgpcsdComponents

IntPtr[]

nativeint[]

[in] Specifies rgpcsdComponents.

hwndPickerDlg
IntPtr

nativeint

[in] Specifies hwndPickerDlg.

pResult
VSADDCOMPRESULT[]

[out] Pointer to a result object.

Returns

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.

Applies to