Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Undocumented feature : QAxBase and void/missing parameter(s) to COM Objects functions
JrFlop last edited by JrFlop
I spent a lot of hours yesterday, trying and reading everywhere that it was impossible to do so. But I had no possible workaround.
I succeeded, doing something very simple at the end, but that is not written anywhere into the documentation or any old discussion of people who all gave up at the end.
Sometimes you should call, on a given COM object, something like.
QAxObject* subObject = (QAxObject*)ParentObject->querySubObject("Item(QVariant Name, QVariant Index)", Name, Index)
But you should enter only Name or Index. In my case no Name was possible so I should ask for Index 0 without giving any name. (not even "null", "", any int or anything : nothing). Parameters taken by "querySubObject" are QVariant but no QVariant available Type nor value did the job of "non arguments"
In fact the only possible existing variable in C++ that does the job is described here but not compatible with Qt QAxObjets : "vtMissing"
https://msdn.microsoft.com/en-us/library/ms675103(v=vs.85).aspx (search for "missing")
It's a VARIANT where the type is VT_ERROR and value is DISP_E_PARAMNOTFOUND
Event VARIANTtoQVariant doesn't do the correct conversion (it gives a type QVariant::Invalid but it's not the same and it doesn't work)
The solution is the following :
You can enter parameters into the string given to querySubObject, for example :
Then if you want to give a non-parameter you should enter "void" as parameter
querySubObject("Item(void, QVariant)", 0, 0); //The first 0 is ignored (first parameter is void), the second 0 is used as second parameter
People who never found the solution :
I was about to give up when I finally found the solution by trying eveything.
Is it possible to document it into QAxBase documentation about querySubObject and dynamicCall ?
Thank you in advance !
Hi and welcome to devnet,
Sure it's possible ! You can even do it yourself :)
You can modify the module's documentation and submit your work for inclusion through gerrit.
JrFlop last edited by
Thank you for your answer, OK then I'll try do it today ;)