我正在尝试使用ActiveQt库来处理一个ActiveX事件,该事件的参数类型为IDis补丁*,如idl文件中的下面所示。
// ...
library RecognitionClientLib
{
importlib("stdole2.tlb");
[
uuid(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX),
helpstring("_IIFactoryEvents Interface")
]
dispinterface _IIRecognizerFactoryEvents
{
properties:
methods:
[id(1), helpstring("method OnError")] void OnError(
[in] LONG ilOperationCode,
[in] BSTR iszDescription
);
[id(2), helpstring("method OnResult")] void OnResult(
[in] IDispatch* ilpSource,
[in] LONG ilOperationCode
);
};
[
uuid(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX),
control,
helpstring("IFactory Class")
]
// ...我使用dumpcpp.exe并为对象生成了一个头文件和一个cpp文件。生成的文件跳过了头文件中所示的事件生成:
// skipping event interface _IIFactoryEvents根据文档,IDis补丁*参数应该转换为"QAxBase::asVariant()“。因此,我试图按以下方式连接这些事件:
ClientLib::IFactory* lpFactory(new ClientLib::IFactory());
bool lbOk(connect(
lpFactory,
SIGNAL(OnError(
int,
const QString&
)),
SLOT(onError(
int,
const QString&
))
));
assert(lbOk);
lbOk = connect(
lpFactory,
SIGNAL(OnResult(
QVariant,
int
)),
SLOT(onResult(
QVariant,
int
))
);
assert(lbOk);连接OnError的信号没有问题,但是OnResult的连接失败了。
对象:连接:没有这样的信号ClientLib::IFactory::OnResult(QAxObject*,int)
请帮我解决IDis补丁*类型的参数类型应该使用的参数类型吗?
非常感谢!
发布于 2016-04-05 14:30:30
请帮我解决IDis补丁*类型的参数类型应该使用的参数类型吗?
IDispatch*映射到QAxObject*:http://doc.qt.io/qt-5/qaxbase.html
发布于 2016-04-06 09:49:47
我发现参数类型应该是QAxBase::asVariant(),而不需要修改,尽管文档中说它是类型的IDis补丁*。
https://stackoverflow.com/questions/36423282
复制相似问题