Safearray problem c++

I'm trying to call a function that requires safearrays as parameters.
I declared the safearray as such:
CString sCar;
sCar = "102559"
SAFEARRAY  *saAccession = NULL;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1
saAccession = SafeArrayCreate(VT_BSTR, 1, rgsabound);
hresult = SafeArrayPutElement(saAccession, &i, sCar.AllocSysString());
My fuction called is:
m_oRSControlDict->QueryReportCreationForOrders(saAccession, saRelateId, saUnfinishedId,ReportAction, FailReason);

The error I'm getting is "Cannot convert parameter1 from "SAFEARRAY*" to "SAFEARRAY**"

Anyone have any ideas?


peterviauAsked:
Who is Participating?
 
themrrobertConnect With a Mentor Commented:
change:
m_oRSControlDict->QueryReportCreationForOrders(saAccession,  saRelateId, saUnfinishedId,ReportAction, FailReason);

to:

m_oRSControlDict->QueryReportCreationForOrders(&saAccession,  saRelateId, saUnfinishedId,ReportAction, FailReason);

and if you get errors on the other parameters add more addressof operators (&)
0
 
TomasPCommented:
Agree with expert. The method expects a pointer to a pointer and you are passing in a pointer
0
All Courses

From novice to tech pro — start learning today.