IDiaEnumInjectedSources
列舉資料來源中包含的各種插入來源。
語法
IDiaEnumInjectedSources : IUnknown
依照 Vtable 順序的方法
下表顯示 IDiaEnumInjectedSources
方法。
方法 | 描述 |
---|---|
IDiaEnumInjectedSources::get__NewEnum | 擷取此列舉值的 IEnumVARIANT 介面版本。 |
IDiaEnumInjectedSources::get_Count | 擷取插入來源的數目。 |
IDiaEnumInjectedSources::Item | 透過索引擷取插入的來源。 |
IDiaEnumInjectedSources::Next | 擷取列舉序列中指定的插入來源數目。 |
IDiaEnumInjectedSources::Skip | 跳過列舉序列中指定的插入來源數目。 |
IDiaEnumInjectedSources::Reset | 將列舉序列重設為開頭。 |
IDiaEnumInjectedSources::Clone | 建立一個列舉值,其中包含與目前列舉值相同的列舉狀態。 |
備註
呼叫端注意事項
呼叫具有特定原始程式檔名稱的 IDiaSession::findInjectedSource 方法,或使用介面的全域唯一標識碼 (GUID) IDiaEnumInjectedSources
呼叫 IDiaSession::getEnumTables 方法來取得這個介面。
範例
本範例示範如何取得 (GetEnumInjectedSources
函式) 以及使用 (DumpAllInjectedSources
函式) IDiaEnumInjectedSources
介面。 如需 PrintPropertyStorage
函式的實作,請參閱 IDiaPropertyStorage 介面。 如需替代的輸出,請參閱 IDiaInjectedSource 介面。
IDiaEnumInjectedSources* GetEnumInjectedSources(IDiaSession *pSession)
{
IDiaEnumInjectedSources* pUnknown = NULL;
REFIID iid = __uuidof(IDiaEnumInjectedSources);
IDiaEnumTables* pEnumTables = NULL;
IDiaTable* pTable = NULL;
ULONG celt = 0;
if (pSession->getEnumTables(&pEnumTables) != S_OK)
{
wprintf(L"ERROR - GetTable() getEnumTables\n");
return NULL;
}
while (pEnumTables->Next(1, &pTable, &celt) == S_OK && celt == 1)
{
// There is only one table that matches the given iid
HRESULT hr = pTable->QueryInterface(iid, (void**)&pUnknown);
pTable->Release();
if (hr == S_OK)
{
break;
}
}
pEnumTables->Release();
return pUnknown;
}
void DumpAllInjectedSources( IDiaSession* pSession)
{
IDiaEnumInjectedSources* pEnumInjSources;
pEnumInjSources = GetEnumInjectedSources(pSession);
if (pEnumInjSources != NULL)
{
IDiaInjectedSource* pInjSource;
ULONG celt = 0;
while(pEnumInjSources->Next(1, &pInjSource, &celt) == S_OK &&
celt == 1)
{
IDiaPropertyStorage *pPropertyStorage;
if (pInjSource->QueryInterface(__uuidof(IDiaPropertyStorage),
(void **)&pPropertyStorage) == S_OK)
{
PrintPropertyStorage(pPropertyStorage);
pPropertyStorage->Release();
}
pInjSource->Release();
}
pEnumInjSources->Release();
}
}
需求
標頭: Dia2.h
程式庫: diaguids.lib
DLL: msdia80.dll