ActiveX data type
-
Hi there,
I try to use a function that returns an array of floats as parameter. The function prototype is:
@Frequencies([in, out] SAFEARRAY(float)*)@My code is:
@
QList<QVariant> variantList;
object->dynamicCall("Frequencies(QList<QVariant>&)", variantList);
@But unfortunately I have the following error:
@Type Mismatch in Parameter. Pass an array of type string or real.@
I also tried QList<QString> and QList<float> with no success.
The documentation of the ActiveX server says:
bq. Use a safearray of strings (VT_BSTR) or reals (VT_R8 for double or VT_R4 for float).
Any idea?
Thanks!
-
Hi,
I didn't use this class but:
- You don't respect the signature of Frequencies when calling dynamicCall
- Frequencies wants a SAFEARRAY that is not the same at all as a QList<QVariant>
-
So how should I call this function?
I think I don't understand what a SAFEARRAY is. Is it something like float[SIZE]?
-
First result of google search gives "this":http://msdn.microsoft.com/en-us/library/windows/desktop/ms221482(v=vs.85).aspx
-
No I think you're mistaken. Qt translates COM types into Qt types. Have a look at "this table":http://harmattan-dev.nokia.com/docs/library/html/qt4/activeqt-server.html#data-types.
So I ask again my question, what's wrong with my code??
-
Still no one?
-
They provide translation for three types of SAFEARRAY none of which is float but it might be replaced by SAFEARRAY(VARIANT). Note it's just an hypothesis.
@Frequencies([in, out] SAFEARRAY(float)*) <- You have a pointer to a SAFEARRAY@
@object->dynamicCall("Frequencies(QList<QVariant>&)", variantList); <- You have a reference to a QVariantList@
Did you tried something like:
@
QVariantList variantList;
object->dynamicCall("Frequencies(SAFEARRAY(float)*)", &variantList);@ -
[quote author="SGaist" date="1369945399"]Did you tried something like:
@
QVariantList variantList;
object->dynamicCall("Frequencies(SAFEARRAY(float)*)", &variantList);@
[/quote]It returns the error:
@error: 'QVariant::QVariant(void*)' is private@
-
I have found how to call this function without error:
@
QStringList list;
for(int i=0; i<length; i++) {
list << "0.0";
}
object->dynamicCall("Frequencies(QStringList&)", list);
@BUT the list variable is not updated... It returns a list of 0.0.
If I don't fill the list with elements the function returns an error that says the array doesn't have the good size.
-
I'm still stuck. Anyone has an idea???
Thanks