Freigeben über


IVsCfgProvider.GetCfgs(UInt32, IVsCfg[], UInt32[], UInt32[]) Method

Definition

Returns the per-configuration objects for this object.

int GetCfgs(unsigned int celt, std::Array <Microsoft::VisualStudio::Shell::Interop::IVsCfg const &> const & rgpcfg, std::Array <unsigned int> const & pcActual, std::Array <unsigned int> const & prgfFlags);
public int GetCfgs (uint celt, Microsoft.VisualStudio.Shell.Interop.IVsCfg[] rgpcfg, uint[] pcActual, uint[] prgfFlags);
abstract member GetCfgs : uint32 * Microsoft.VisualStudio.Shell.Interop.IVsCfg[] * uint32[] * uint32[] -> int
Public Function GetCfgs (celt As UInteger, rgpcfg As IVsCfg(), Optional pcActual As UInteger(), Optional prgfFlags As UInteger()) As Integer

Parameters

celt
UInt32

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

rgpcfg
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
UInt32[]

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

prgfFlags
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

Returns

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

Examples

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);

Remarks

COM Signature

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);

Applies to