IVsComponentUser::AddComponent Method (VSADDCOMPOPERATION, UInt32, array<IntPtr>^, IntPtr, array<VSADDCOMPRESULT>^)

 

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)

int AddComponent(
	VSADDCOMPOPERATION dwAddCompOperation,
	unsigned int cComponents,
	array<IntPtr>^ rgpcsdComponents,
	IntPtr hwndPickerDlg,
	array<VSADDCOMPRESULT>^ pResult
)

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.

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.

Return to top
Show: