Hi to all,
I have to access a COM component method having this signature :
HRESULT SetBillValueEnables([in, out] SAFEARRAY(VARIANT_BOOL)* billValueEnables);
HRESULT SetBillValueEnables([in, out] SAFEARRAY(VARIANT_BOOL)* billValueEnables);
To copy to clipboard, switch view to plain text mode
I used the dumpcpp tool to import the type lib header, and according to
http://doc.qt.io/qt-4.8/http://qt-project.org/doc/qt-4.8/qaxbase.html
I tried this
QList<QVariant> billValuesToDevice;
billValuesToDevice << false << false << false << false << false;
QList<QVariant> parameters;
parameters << billValuesToDevice;
_acc->dynamicCall("SetBillValueEnables(QList<QVariant>*&)",parameters);
QList<QVariant> billValuesToDevice;
billValuesToDevice << false << false << false << false << false;
QList<QVariant> parameters;
parameters << billValuesToDevice;
_acc->dynamicCall("SetBillValueEnables(QList<QVariant>*&)",parameters);
To copy to clipboard, switch view to plain text mode
But as result, I receive the error message :
QAxBase: Error calling IDispatch member SetBillValueEnables: Unknown error
I first thought that the issue was caused by the COM implementation of the API, so I give it a try with Visual C++, and there it works fine with :
SAFEARRAYBOUND bounds;
bounds.cElements = 5;
bounds.lLbound = 0;
SAFEARRAY *pNewValues;
pNewValues = SafeArrayCreate(VT_BOOL,1,&bounds);
short output[5];
for (long i=0; i<5; i++)
{
output[i] = true;
SafeArrayPutElement(pNewValues,&i,&(output[i]));
output[i] = false;
}
_pAcceptor->SetBillValueEnables(&pNewValues);
SAFEARRAYBOUND bounds;
bounds.cElements = 5;
bounds.lLbound = 0;
SAFEARRAY *pNewValues;
pNewValues = SafeArrayCreate(VT_BOOL,1,&bounds);
short output[5];
for (long i=0; i<5; i++)
{
output[i] = true;
SafeArrayPutElement(pNewValues,&i,&(output[i]));
output[i] = false;
}
_pAcceptor->SetBillValueEnables(&pNewValues);
To copy to clipboard, switch view to plain text mode
Can someone please help me with this, or confirm that SAFEARRAY(VARIANT_BOOL)* is not a supported parameter type ?
Bookmarks