IDiaTableIDiaTable
Énumère une table de source de données DIA.Enumerates a DIA data source table.
SyntaxeSyntax
IDiaTable : IEnumUnknown
Méthodes dans l'ordre VtableMethods in Vtable Order
Le tableau suivant présente les méthodes de IDiaTable
.The following table shows the methods of IDiaTable
.
MéthodeMethod | DescriptionDescription |
---|---|
IDiaTable::get__NewEnumIDiaTable::get__NewEnum | Récupère le IEnumVARIANT Interface version de cet énumérateur.Retrieves the IEnumVARIANT Interface version of this enumerator. |
IDiaTable::get_nameIDiaTable::get_name | Récupère le nom de la table.Retrieves the name of the table. |
IDiaTable::get_CountIDiaTable::get_Count | Récupère le nombre d’éléments dans la table.Retrieves the number of items in the table. |
IDiaTable::ItemIDiaTable::Item | Récupère une référence à un index de l’entrée en question.Retrieves a reference to a particular entry index. |
NotesRemarks
Cette interface implémente la IEnumUnknown
méthodes d’énumération dans l’espace de noms d’assemblys Microsoft.VisualStudio.OLE.Interop.This interface implements the IEnumUnknown
enumeration methods in the Microsoft.VisualStudio.OLE.Interop namespace. Le IEnumUnknown
interface d’énumération est beaucoup plus efficace pour itérer sur la table des matières à le IDiaTable::get_Count et IDiaTable::Item méthodes.The IEnumUnknown
enumeration interface is much more efficient for iterating over the table contents than the IDiaTable::get_Count and IDiaTable::Item methods.
L’interprétation de la IUnknown
interface retournée à partir de le le IDiaTable::Item
(méthode) ou Next
(méthode) (dans l’espace de noms d’assemblys Microsoft.VisualStudio.OLE.Interop) est dépendant du type de table.The interpretation of the IUnknown
interface returned from either the IDiaTable::Item
method or the Next
method (in the Microsoft.VisualStudio.OLE.Interop namespace) is dependent on the type of table. Par exemple, si le IDiaTable
interface représente une liste de sources injectées, le IUnknown
interface doit être interrogé pour la IDiaInjectedSource interface.For example, if the IDiaTable
interface represents a list of injected sources, the IUnknown
interface should be queried for the IDiaInjectedSource interface.
Remarques pour les appelantsNotes for Callers
Obtenez cette interface en appelant le IDiaEnumTables::Item ou IDiaEnumTables::Next méthodes.Obtain this interface by calling the IDiaEnumTables::Item or IDiaEnumTables::Next methods.
Les interfaces suivantes sont implémentées avec la IDiaTable
interface (autrement dit, vous pouvez interroger la IDiaTable
interface pour l’une des interfaces suivantes) :The following interfaces are implemented with the IDiaTable
interface (that is, you can query the IDiaTable
interface for one of the following interfaces):
ExempleExample
La première fonction ShowTableNames
, affiche les noms de toutes les tables dans la session.The first function, ShowTableNames
, displays the names of all the tables in the session. La deuxième fonction GetTable
, recherche toutes les tables pour une table qui implémente une interface spécifiée.The second function, GetTable
, searches all of the tables for a table that implements a specified interface. La troisième fonction UseTable
, montre comment utiliser le GetTable
(fonction).The third function, UseTable
, shows how to use the GetTable
function.
Note
CDiaBSTR
est une classe qui encapsule un BSTR
et gère automatiquement la libération de la chaîne lors de l’instanciation est hors de portée.CDiaBSTR
is a class that wraps a BSTR
and automatically handles freeing the string when the instantiation goes out of scope.
void ShowTableNames(IDiaSession *pSession)
{
CComPtr<IDiaEnumTables> pTables;
if ( FAILED( psession->getEnumTables( &pTables ) ) )
{
Fatal( "getEnumTables" );
}
CComPtr< IDiaTable > pTable;
while ( SUCCEEDED( hr = pTables->Next( 1, &pTable, &celt ) )
&& celt == 1 )
{
CDiaBSTR bstrTableName;
if ( pTable->get_name( &bstrTableName ) != 0 )
{
Fatal( "get_name" );
}
printf( "Found table: %ws\n", bstrTableName );
}
// Searches the list of all tables for a table that supports
// the specified interface. Use this function to obtain an
// enumeration interface.
HRESULT GetTable(IDiaSession* pSession,
REFIID iid,
void** ppUnk)
{
CComPtr<IDiaEnumTables> pEnumTables;
HRESULT hResult;
if (FAILED(pSession->getEnumTables(&pEnumTables)))
Fatal("getEnumTables");
CComPtr<IDiaTable> pTable;
ULONG celt = 0;
while (SUCCEEDED(hResult = pEnumTables->Next(1, &pTable, &celt)) &&
celt == 1)
{
if (pTable->QueryInterface(iid, (void**)ppUnk) == S_OK)
{
return S_OK;
}
pTable = NULL;
}
if (FAILED(hResult))
Fatal("EnumTables->Next");
return E_FAIL;
}
// This function shows how to use the GetTable function.
void UseTable(IDiaSession *pSession)
{
CComPtr<IDiaEnumSegments> pEnumSegments;
if (SUCCEEDED(GetTable(pSession, __uuidof(IDiaEnumSegments), &pEnumSegments)))
{
// Do something with pEnumSegments.
}
}
SpécificationsRequirements
En-tête : Dia2.hHeader: Dia2.h
Bibliothèque : diaguids.libLibrary: diaguids.lib
DLL : msdia80.dllDLL: msdia80.dll
Voir aussiSee Also
Interfaces (Debug Interface Access SDK) Interfaces (Debug Interface Access SDK)
IDiaEnumTables IDiaEnumTables
IDiaEnumTables::Item IDiaEnumTables::Item
IDiaEnumTables::NextIDiaEnumTables::Next