Udostępnij za pośrednictwem


IVsCfgProvider.GetCfgs Method

Returns the per-configuration objects for this object.

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

Syntax

'Declaration
Function GetCfgs ( _
    celt As UInteger, _
    <OutAttribute> rgpcfg As IVsCfg(), _
    <OutAttribute> pcActual As UInteger(), _
    <OutAttribute> prgfFlags As UInteger() _
) As Integer
int GetCfgs(
    uint celt,
    IVsCfg[] rgpcfg,
    uint[] pcActual,
    uint[] prgfFlags
)
int GetCfgs(
    [InAttribute] unsigned int celt, 
    [OutAttribute] array<IVsCfg^>^ rgpcfg, 
    [OutAttribute] array<unsigned int>^ pcActual, 
    [OutAttribute] array<unsigned int>^ prgfFlags
)
abstract GetCfgs : 
        celt:uint32 * 
        rgpcfg:IVsCfg[] byref * 
        pcActual:uint32[] byref * 
        prgfFlags:uint32[] byref -> int 
function GetCfgs(
    celt : uint, 
    rgpcfg : IVsCfg[], 
    pcActual : uint[], 
    prgfFlags : uint[]
) : int

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 nulla null reference (Nothing in Visual Basic). 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 nulla null reference (Nothing in Visual Basic), if this information is not necessary.
  • prgfFlags
    Type: array<System.UInt32[]
    [out, optional] Flags that specify settings for project configurations, or nulla null reference (Nothing in Visual Basic) 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.

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 nulla null reference (Nothing in Visual Basic) 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);

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

.NET Framework Security

See Also

Reference

IVsCfgProvider Interface

Microsoft.VisualStudio.Shell.Interop Namespace