Board index » delphi » Calling one instance of an automation object multiple times

Calling one instance of an automation object multiple times

Hello!

I made an InProc automation object using Delphi3 lately. What I want
to do with it is to create an instance of it in VBScript using
CreateObject in a sub. Then I should get a pointer to it with
GetObject in another sub. Take a look at this example:

______________________________________________________

Sub window_onLoad()
  Dim vObject
  set vObject = CreateObject("Object.Automation")
  vObject.Start
End Sub

Sub Check_OnClick()
  Dim vLObject
  set vLObject = GetObject("", "Object.Automation")

'>>> Insert some calls to vLObject's methods and properties here <<<'

  set vLObject = Nothing
End Sub
______________________________________________________

What I get when I try it in internet explorer 4 is this error message:

        "Unexpected call to method or property access."

I get prompted from this error each time I try to access a method or a
property inserted where specified in the source code written in this
message.

Is there a way to make it work? You should know that I cannot use
vObject, created with CreateObject but I want to use the same instance
that's been created in Sub window_onLoad()...

Mark
EPIX inc.

 

Re:Calling one instance of an automation object multiple times


In my (limited) VB experience, I've found that moving the Dim vObject into
global scope works the best for me.  However, the fact that you're
attempting this from within IE may be your problem.  I don't think that
VBScript in IE allows CreateObject, for security reasons.

Quote
Marc Lacoursiere wrote in message <351018a0.12899...@news.total.net>...
>Hello!

>I made an InProc automation object using Delphi3 lately. What I want
>to do with it is to create an instance of it in VBScript using
>CreateObject in a sub. Then I should get a pointer to it with
>GetObject in another sub. Take a look at this example:

>______________________________________________________

>Sub window_onLoad()
>  Dim vObject
>  set vObject = CreateObject("Object.Automation")
>  vObject.Start
>End Sub

>Sub Check_OnClick()
>  Dim vLObject
>  set vLObject = GetObject("", "Object.Automation")

>'>>> Insert some calls to vLObject's methods and properties here <<<'

>  set vLObject = Nothing
>End Sub
>______________________________________________________

>What I get when I try it in internet explorer 4 is this error message:

> "Unexpected call to method or property access."

>I get prompted from this error each time I try to access a method or a
>property inserted where specified in the source code written in this
>message.

>Is there a way to make it work? You should know that I cannot use
>vObject, created with CreateObject but I want to use the same instance
>that's been created in Sub window_onLoad()...

>Mark
>EPIX inc.

Re:Calling one instance of an automation object multiple times


Quote
>In my (limited) VB experience, I've found that moving the Dim vObject into
>global scope works the best for me.  However, the fact that you're
>attempting this from within IE may be your problem.  I don't think that
>VBScript in IE allows CreateObject, for security reasons.

Firstly, my first goal is not to implement this in Internet Explorer.
I want it to be included in a source code generated by Obsydian 3. I
use Explorer 4 for tests purposes. In Obsydian, it's impossible to set
global variables in vb scopes, so, for this this reason, I'm trying to
make it work in explorer in 2 different subs with local variables.

Mark
EPIX inc.

Re:Calling one instance of an automation object multiple times


I found on microsoft support online that vbscript v1.0 did not support
creatobject (it now does)

Quote
John A. Tasler wrote in message

<#JpNniwU9GA....@uppssnewspub04.moswest.msn.net>...
Quote
>In my (limited) VB experience, I've found that moving the Dim vObject into
>global scope works the best for me.  However, the fact that you're
>attempting this from within IE may be your problem.  I don't think that
>VBScript in IE allows CreateObject, for security reasons.

Andy Smith

Other Threads