c++ - Qt ActiveX 动态调用返回值始终为空

标签 c++ qt activex qstring bstr

这是上一个问题的后续:Qt ActiveX

我正在尝试在我的程序中使用 ActiveX 控件。

QAxWidget* mAX = new QAxWidget();
mAX->setControl("{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}");

我知道有一个像下面这样的函数(使用getDocumentation()):

SendCommand(QString input, QString& output)

但是当我尝试执行它时:

QString returString;
mAX->dynamicCall("SendCommand(QString,QString&)","something",returnString);

我总是得到:

returString = "";

我在网上搜索并看到了他们的错误跟踪器上报告的类似错误。似乎还没有修复:

Calling functions through dynamicCall() don't return values by QVariant

还有一篇帖子,其中有人似乎遇到了同样的问题:

QAxObject and dynamicCall

有人知道解决方案/解决方法吗?

编辑:

原函数为SendCommand(LPCTSTR command,BSTR* ret)

也许 BSTR* 作为 &QString 处理方式存在问题?

最佳答案

您可以使用此解决方案

QString strRetVal;
QVariant returnValue("");
QVariant param1("something");
QList<QVariant> inplist;
inplist<<param1;
inplist<<returnValue;
mAX->dynamicCall("SendCommand(QString,QString&)",inplist );
strRetVal=inplist.at(1).toString();

关于c++ - Qt ActiveX 动态调用返回值始终为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14945598/

相关文章:

c++ - boost 中默认的随机数生成器种子是什么?

c++ - 顺序容器 || C++ Primer 第五版习题 9.22

c++ - 如何正确有效地执行基于尺寸项目网格的排序?

c++ - 我怎样才能圆一个 QWidgets 的角落?

javascript - 极其奇怪的行为 : IE11 seems to create an invisible tab when scripts are blocked and then allowed - how to fix it?

windows - QAxBase dynamicCall与指针参数

c++ - 为什么容器的分配器作为模板参数传递?

c++ - 尝试使用 Qt 和 OpenCV 从高清网络摄像头获取 1080p 实时视频只能获取 480p

c++ - 如何确定 QString 中的特定字符是字母还是标点符号?

c++ - VS2010 IntelliSense 说 : CComPtr is not a template