Export (0) Print
Expand All

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)

int AddComponent (
	[InAttribute] VSADDCOMPOPERATION dwAddCompOperation,
	[InAttribute] uint cComponents,
	[InAttribute] IntPtr[] rgpcsdComponents,
	[InAttribute] IntPtr hwndPickerDlg,
	[OutAttribute] VSADDCOMPRESULT[] pResult
)
int AddComponent (
	/** @attribute InAttribute() */ VSADDCOMPOPERATION dwAddCompOperation, 
	/** @attribute InAttribute() */ UInt32 cComponents, 
	/** @attribute InAttribute() */ IntPtr[] rgpcsdComponents, 
	/** @attribute InAttribute() */ IntPtr hwndPickerDlg, 
	/** @attribute OutAttribute() */ VSADDCOMPRESULT[] pResult
)
function AddComponent (
	dwAddCompOperation : VSADDCOMPOPERATION, 
	cComponents : uint, 
	rgpcsdComponents : IntPtr[], 
	hwndPickerDlg : IntPtr, 
	pResult : VSADDCOMPRESULT[]
) : int

Parameters

dwAddCompOperation

[in] Double word containing the add component operation.

cComponents

[in] Count of components.

rgpcsdComponents

[in] Specifies rgpcsdComponents.

hwndPickerDlg

[in] Specifies hwndPickerDlg.

pResult

[out] Pointer to a result object.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

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.

Community Additions

ADD
Show:
© 2014 Microsoft