我有以下代码片段,
IUpdateSession *iUpdate;
IUpdateSearcher *updateSearcher;
ISearchResult* pISearchResults;
IUpdateCollection* pIUpdateCollection;
IStringCollection *pIStrCollCVEs;
IUpdate2 *pIUpdate;
long lUpdateCount;
...
CoCreateInstance(
CLSID_UpdateSession,
NULL,
CLSCTX_INPROC_SERVER,
IID_IUpdateSession,
(LPVOID*)&iUpdate
);
iUpdate->CreateUpdateSearcher(&updateSearcher);
printf("\n Searching updates");
updateSearcher->Search(_bstr_t(_T("IsInstalled = 0")), &pISearchResults);
printf("\n Following updates found..\n");
pISearchResults->get_Updates(&pIUpdateCollection);
pIUpdateCollection->get_Count(&lUpdateCount);
LONG lCount;
BSTR buff;
while (0 != lUpdateCount)
{
pIUpdateCollection->get_Item(lUpdateCount, &pIUpdate);
pIUpdate->get_CveIDs(&pIStrCollCVEs);
pIStrCollCVEs->get_Count(&lCount);
pIUpdate->get_Title(&buff);
printf("TITLE : %s \n", buff);
while(0 != lCount)
{
pIStrCollCVEs ->get_Item(lCount, &buff);
_bstr_t b(buff);
printf("CVEID = %s \n", buff);
lCount --;
}
printf("\n");
lUpdateCount --;
}
::CoUninitialize();
getchar();
错误:错误 C2664:“IUpdateCollection::get_Item”:无法将参数 2 从“IUpdate2 * *”转换为“IUpdate * *”
@Line43
如何获取指向 IUpdate2 接口的指针,