IVsCfgProvider::GetCfgs Method (UInt32, array<IVsCfg^>^, array<UInt32>^, array<UInt32>^)

 

Returns the per-configuration objects for this object.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int GetCfgs(
	unsigned int celt,
	array<IVsCfg^>^ rgpcfg,
	array<unsigned int>^ pcActual,
	array<unsigned int>^ prgfFlags
)

Parameters

celt
Type: System::UInt32

[in] Number of configuration objects to be returned or zero, indicating a request for an unknown number of objects.

rgpcfg
Type: array<Microsoft.VisualStudio.Shell.Interop::IVsCfg^>^

[in, out, size_is(celt)] On input, pointer to an interface array or null. On output, this parameter points to an array of IVsCfg interfaces belonging to the requested configuration objects.

pcActual
Type: array<System::UInt32>^

[out, optional] Pointer to the number of configuration objects actually returned or null, if this information is not necessary.

prgfFlags
Type: array<System::UInt32>^

[out, optional] Flags that specify settings for project configurations, or null if no additional flag settings are required. For valid prgrFlags values, see __VSCFGFLAGS

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 IVsCfgProvider::GetCfgs(
   [in] ULONG celt,
   [in, out, size_is(celt)] IVsCfg *rgpcfg[],
   [out, optional] ULONG *pcActual,
   [out, optional] VSCFGFLAGS *prgfFlags
);

If the pcActual parameter is a valid address and the celt parameter is set to zero, the number of configuration objects is returned in pcActual. The number of objects returned is less than or equal to the value of celt. If the total number of configuration objects is less than the value of celt, then all of the configuration objects are returned. If the total number of objects is greater than celt, the number of returned objects is limited to celt and *pcActual is set to celt on output.

If celt is non-zero, rgpcfg must not be null or E_POINTER is returned.

Typically, calls are made to GetCfgs as follows. The caller specifies 0 for the object count and null for the interface array pointer. GetCfgs returns the number of configuration objects in the contents of pcActual, information that can be used by the caller to allocate space for the interface array. A second call to GetCfgs is made with the object count set and the array pointer pointing to a valid address. The following code sample illustrates this call sequence:

hr = pIVsCfgProvider->GetCfgs(0, null, &cExpected, null);

prgpcfgs = ::CoTaskMemAlloc(cExpected * sizeof(IVsCfg *));

hr = pIVsCfgProvider->GetCfgs(cExpected, prgpcfgs, &cActual, null);

An extremely common pattern is something like the following (omitting error checks for readability):

hr = pIVsCfgProvider->GetCfgs(0, null, &cExpected, null);

prgpcfgs = ::CoTaskMemAlloc(cExpected * sizeof(IVsCfg *));

hr = pIVsCfgProvider->GetCfgs(cExpected, prgpcfgs, &cActual, NULL);

Return to top
Show: