다음을 통해 공유


IVsProject4.GetFilesWithItemType Method

Returns an array of VSITEMIDs of files whose MSBuild ItemType matches the given string. The comparison is case insensitive.

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

Syntax

'Declaration
Function GetFilesWithItemType ( _
    pszItemType As String, _
    celt As UInteger, _
    <OutAttribute> rgItemids As UInteger(), _
    <OutAttribute> ByRef pcActual As UInteger _
) As Integer
int GetFilesWithItemType(
    string pszItemType,
    uint celt,
    uint[] rgItemids,
    out uint pcActual
)
int GetFilesWithItemType(
    [InAttribute] String^ pszItemType, 
    [InAttribute] unsigned int celt, 
    [OutAttribute] array<unsigned int>^ rgItemids, 
    [OutAttribute] unsigned int% pcActual
)
abstract GetFilesWithItemType : 
        pszItemType:string * 
        celt:uint32 * 
        rgItemids:uint32[] byref * 
        pcActual:uint32 byref -> int
function GetFilesWithItemType(
    pszItemType : String, 
    celt : uint, 
    rgItemids : uint[], 
    pcActual : uint
) : int

Parameters

  • pszItemType
    Type: String

    The ItemType.

  • celt
    Type: UInt32

    The number of files to return.

  • rgItemids
    Type: array<UInt32[]

    The array of ITEMIDs.

  • pcActual
    Type: UInt32%

    The actual number of files returned.

Return Value

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

Remarks

If celt is zero and rgItemids is NULL, the number of matching files is returned in pcActual. If celt is not zero, rgItemids must not be NULL, or E_POINTER is returned.

Examples

An extremely common pattern is to call the method twice, the first time passing in 0 for the number of items and NULL for the array, and the second time passing in a properly-sized array and the actual number of items, and like the following (omitting error checks for readability):

hr = pIVsProject4->GetFilesWithItemType(szItemType, 0, NULL, &cExpected);
VSITEMID *rgItemids = ::CoTaskMemAlloc(cExpected * sizeof(VSITEMID));
hr = pIVsProject4->GetFilesWithItemType(szItemType, cExpected, rgItemids, &cActual);

.NET Framework Security

See Also

Reference

IVsProject4 Interface

Microsoft.VisualStudio.Shell.Interop Namespace