PDA

View Full Version : ActiveQt, activeX return values from methods



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

joyer83
3rd June 2011, 12:58
Hi!

Shouldn't this:
setControl( CLASSID );

Be this:
m_pAxWidget->setControl( CLASSID );

sky
3rd June 2011, 13:02
Hi Joyer83,

Oops!. Actually the class has a setControl which calls m_pAxWidget->setControl( CLASSID );

Thanks,
Sky.

joyer83
3rd June 2011, 14:02
Hmm, maybe you could then use debugger to check what happens inside the dynamicCall() method?

dbzhang800
6th June 2011, 07:39
I think you should look at its manual which can be generated by following code



QString html = m_pAxWidget->generateDocumentation ();


you can save to an .html file or show it in an QTextBrowser or webview.