A: 

After some experimentation, I was able to solve this by doing something I thought I'd tried earlier: creating a new QThread and calling QAxWidget::dynamicCall from the new thread. I must not have coded it correctly the first time I tried this solution; after sitting with a co-worker, we were able to get it to work. To be specific, what we did is:

(Step 1) Created a subclass of QThread to represent the thread I need to call dynamicCall().

(Step 2) In the constructor of my QThread, pass in a pointer to my original QAxWidget, and keep the pointer in a member variable.

MyThread::MyThread(QAxWidget* passedWidget) : QThread()  
{  
    actualWidget = passedWidget;  
}  

(Step 3) In the run() method of the QThread, call the dynamicCall() method of the QAxWidget.

void MyThread::run()  
{  
    QVariant result = actualWidget->dynamicCall(...parms as necessary...);  
}  

(Step 4) Back in my main code, when I need to execute dynamicCall(), I just call the start() method of MyThread. The start() method will execute run() in its own thread, thus sending the necessary command to the ActiveX object without blocking or stalling the main GUI thread.

dbisdorf
A: 

Hi,

I am trying the same thing for a project of mine. But the solution that you gave doesn't seems to work.

What I could find on the net was that you need to do CoIntialize for each thread.

It would be really great if you can share a code snippet with me.

Dhiraj Chawla
I'm not sure what else to share with you without knowing specifically what isn't working for you. Is your dynamicCall not getting executed, or is it still locking up the GUI? StackOverflow really isn't set up as a message board; it might be best if we could exchange code offline and I could provide an updated solution on StackOverflow if/when we find a solution. My contact information is in my user profile - shoot me an email and I'll reply with a longer code sample.
dbisdorf