
Problem with Windows Script Control and Timeout in an ActiveX Dll
I'm using the Windows Script Contol to implement basic scripting ability in
an app.
I have referenced the control and am instantiating the control as follows:
Private WithEvents oScr as ScriptControl
Set oScr = New ScriptControl
So far, all is well and good.
Next I set a few properties:
oScr.AllowUI = False
oScr.Timeout = lTimeout ' lTimeout is a long containg the number
of milliseconds (by default 60000)
Next I load in script which is contained in a text file into a string. It
is very short, typically no more than 20 lines.
Then I add that code to the script control
oScr.AddCode sCode
Finally, I run the script by calling the "Main" sub (which is in the script
file)
oScr.Run "Main"
This works well the script runs just fine and everything is good.
According to the docs, if the script takes more time to run than the
timeout, it will be terminated. This is the problem I am having. The
script will not get terminated if it times out and I can think of no way to
force it to terminate. One odd thing about this, is if I repeat the steps
above with a standard VB Windows project, it works fine and the timeout
occurs. If I do this in an ActiveX Dll, I don't get the timeout.
Can anyone shed any light on this problem?
Thanks
Chris Dunaway