Solved QAxObject calls seem to timeout, how to debug
-
Hello,
I want to remote controll another application using QAxObject but I am struggling getting the most basic example to work:I created an application with just one button that is connected to this slot:
void MainWindow::callWord() { QAxObject* word_app = new QAxObject("Word.Application", this); QAxObject* document_collection = word_app->querySubObject("Documents"); document_collection->dynamicCall("Add()"); }
When executing the slots, the application hangs for several seconds, but nothing happens in Word. When calling basically the same code in powershell, I get a new document.
When changing "Add()" to something else, I get at least an error message of "No such property in...". I am now out of ideas what to do next how to further debug the situation.
This is a nailed down example, I tried remote controlling another application with basically the same sympthoms: I get error messages when trying to call non existent methods, but calls to methods that seem to be exist are not successfull.
Does anyone has more ideas how to digg into this?
I am runing Qt 5.9.1 using the MinGW Compiler on Windows 10, most recent version
-
I found it myself: The code was indeed working but the instances of word where hidden. After calling setProperty("Visible", true) on the word_app, the window finally becomes visible. I only found this after an update of office today. After the updater was complete and restored all open office applications, I had 20 instances of word running.