Qt ActiveX dynamicCall:错误的参数计数 [英] Qt ActiveX dynamicCall: bad parameter count

查看:83
本文介绍了Qt ActiveX dynamicCall:错误的参数计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to use an ActiveX control in my program.

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

我知道有一个功能:

put_ChannelType(long newValue)

但是当我尝试执行它:

mAX->dynamicCall("put_ChannelType(long)",2);
mAX->dynamicCall("put_ChannelType(int)",2);
mAX->dynamicCall("put_ChannelType(long)",QVariant(2));
mAX->dynamicCall("put_ChannelType(int)",QVariant(2));

我得到:

QAxBase: Error calling IDispatch member put_ChannelType: Bad parameter count

任何想法是什么出问题了?

Any idea what is going wrong ?

编辑:

奇怪的是,如果我打电话

Weird thing is if I call

mAX->dynamicCall("put_ChannelType()");

我没有收到任何错误消息...

I do not get any error message...

编辑2:

这也失败了(如康斯坦丁建议)

This also fails (as Constantin suggested)

QList<QVariant> varlist;
varlist << (int)1;
mAX->dynamicCall("put_ChannelType(int)",varlist);


推荐答案

使用解决了这个问题generateDocumentation()函数。

我在另一个应用程序中使用了此ActiveX控件,但在MFC中使用了它。

I was using this ActiveX control in another application, but an MFC one.

似乎我指的功能名称(在VS创建的机器生成的IDispatch包装器类中)与列出的Qt不同。

It seems the function names I was referring to (which were in a machine generated IDispatch wrapper class created by VS) were not the same as the ones Qt listed.

ie put_ChannelType实际上是SetChannelType ...

i.e. put_ChannelType is actually SetChannelType...

也许这只是版本问题?

无论如何,重要的部分是知道 generateDocumentation()可以列出您可以使用 dynamicCall 调用的所有功能。

Anyways, important part is knowing that generateDocumentation() can list you all the functions you can call with dynamicCall.

这篇关于Qt ActiveX dynamicCall:错误的参数计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆