QAxScriptManager and QAxScript problem when used inside a QThread's run() function
-
I've a simple VBScript code which I'm executing using QAxScriptManager and QAxScript in Windows.
The same exact VBScript returns an error complaining there is no such function in my VBScript file when I'm trying to execute it inside the thread's run() function.
Note that the script works when it is called from outside run() function, for example in thread's constructor.
Any idea why this happens? -
I noticed that the cause of the problem is here, but still can't see why this is happening.
@
QAxScriptManager *scrMgr = new QAxScriptManager(this);
QAxScript *scrpt = scrMgr->load(":/Scr/SomeScr.vbs", "MyScr");
if(!scrpt)
// QAxScriptManager failed to load the script!
@QAxScriptManager::load() function returns 0 :(
-
Hi,
Maybe "this":http://www.qtcentre.org/threads/54679-QAxScriptManager-not-returning-a-QAxScript*-for-VBScript will help
-
Unfortunately not. He mentions the following code solved his problem.
@
QWidget *widget = new QWidget();
QAxScriptManager *m_manager = new QAxScriptManager(widget);
@
But I'm not allowed to create a widget inside a non-gui thread. Creating a QObject also didn't help!