sky
3rd June 2011, 12:52
Hi All,
I am trying to wrap an activeX object with a QAxWidget and invoke some methods on it. I am able to invoke methods which have parameters and am able to get the return values. But for methods which do not have any parameter I am able to invoke them but am not able to get the return arguments. The following are the few ways I have tired it:
eg: The active X object has methods:
a. string getName()
b string getAddress(int)
void myWidget::check(CLASSID)
{
m_pAxWidget = new QAxWidget();
bool b;
b = connect(m_pAxWidget, SIGNAL(exception(int,QString,QString,QString)), this,
SLOT(exception(int,QString,QString,QString)));
setControl( CLASSID );
}
void myWidget::readit()
{
QString ret;
QMetaObject::invokeMethod(m_pAxWidget, "getName", Qt::DirectConnection,
Q_RETURN_ARG(QString, ret));
qDebug()<<ret; // prints an empty ""
ret = (m_pAxWidget->dynamicCall("getName")).toString();
qDebug()<<ret; // prints an empty ""
}
I have checked all over the place but couldn't locate anybody facing this problem or posting a solution for it.
Sky
I am trying to wrap an activeX object with a QAxWidget and invoke some methods on it. I am able to invoke methods which have parameters and am able to get the return values. But for methods which do not have any parameter I am able to invoke them but am not able to get the return arguments. The following are the few ways I have tired it:
eg: The active X object has methods:
a. string getName()
b string getAddress(int)
void myWidget::check(CLASSID)
{
m_pAxWidget = new QAxWidget();
bool b;
b = connect(m_pAxWidget, SIGNAL(exception(int,QString,QString,QString)), this,
SLOT(exception(int,QString,QString,QString)));
setControl( CLASSID );
}
void myWidget::readit()
{
QString ret;
QMetaObject::invokeMethod(m_pAxWidget, "getName", Qt::DirectConnection,
Q_RETURN_ARG(QString, ret));
qDebug()<<ret; // prints an empty ""
ret = (m_pAxWidget->dynamicCall("getName")).toString();
qDebug()<<ret; // prints an empty ""
}
I have checked all over the place but couldn't locate anybody facing this problem or posting a solution for it.
Sky