QAxBase::dynamicCall() type missmatch with BSTR

  activex, c++, com, qt

I am currently using QTaxcontainer to use COM in a simple main file.

I have an object:

QAxObject *myComObj("the.Name");

which is initialized correctly as I successfully accessed some simple functions using:

myComObj->dynamicCall("easyFun()");

Now I hava a more complex method to access which needs a BSTR, it is defined on the activeX side as:

[id(2)] void myfun(BSTR* arg1, short arg2, long arg3, BSTR* arg4, short arg5);

I tried accessing it with :

myComObj->dynamicCall("myfun(BSTR*, short, long, BSTR*, short)", L"A string", 12, 13, L"A string", 1);

or

myComObj->dynamicCall("myfun(BSTR*, short, long, BSTR*, short)", "A string", 12, 13, "A string", 1);

or

myComObj->dynamicCall("myfun(const QString&, short, long, const QString&, short)", "A string", 12, 13, "A string", 1);

But I always got a "Type mismatch in parameter 0" error.

Any idea how to pass a BSTR as an argument to QAxBase::dynamicCall() ?

Source: Windows Questions C++

LEAVE A COMMENT