QAxScriptManager and QAxScript problem when used inside a QThread's run() function
-
wrote on 18 Nov 2013, 14:59 last edited by
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? -
wrote on 18 Nov 2013, 15:22 last edited by
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
-
wrote on 19 Nov 2013, 09:10 last edited by
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! -
wrote on 19 Nov 2013, 12:34 last edited by
I'm changing to QTimer for the time being, cause it also solves my problem but it wouldn't be a threaded application design the way I want it :(
4/5