读SAFEARRAY,内容是BSTR一维数组


参考:https://msdn.microsoft.com/zh-cn/library/ms891243
 
SAFEARRAY* psa = NULL;//=new SAFEARRAY();
 
ipFissSchemeManager->get_Schemes(QStringConvertion::QStr2_bstr_t(strSchemeTable), &psa);
long lBound = 0, uBound = 0;
SafeArrayGetLBound(psa, 1, &lBound);
SafeArrayGetUBound(psa, 1, &uBound);
BSTR BSTRTemp;
BSTR HUGEP *pBSTR;
HRESULT hr;
long cElements = uBound-lBound;
// Get a pointer to the elements of the array.
hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pBSTR);
for (long i = 0; i < cElements; ++i)
{
BSTR bstrTest = pBSTR[i];
}
SafeArrayUnaccessData(psa);

posted on 2015-07-31 10:05  icyber  阅读(558)  评论(0编辑  收藏  举报