Board index » delphi » Calling an ole automation method in a string.

Calling an ole automation method in a string.

Perhaps someone can answer this question for me.

I instantiate an ole server using CreateOleObject.  I then want to call a
method that I have the name of in a string variable.  Any ideas?

example:

  MethodString := 'HelloWorld';
  v := CreateOleObject( 'MyServer.Fish' );
  { now I want to call v.helloworld, but using the methodstring somehow! }

Any help is greatly appreciated!

Mark Ford

 

Re:Calling an ole automation method in a string.


I really have no idea if this would work, but have you tried typecasting
the string as a procedure or function (whichever it is)?

Russ Chinoy

Mark Ford <markf...@tiac.net> wrote in article
<5ctb01$...@hpngsv01.mgh.harvard.edu>...

Quote
> Perhaps someone can answer this question for me.

> I instantiate an ole server using CreateOleObject.  I then want to call a
> method that I have the name of in a string variable.  Any ideas?

> example:

>   MethodString := 'HelloWorld';
>   v := CreateOleObject( 'MyServer.Fish' );
>   { now I want to call v.helloworld, but using the methodstring somehow!
}

> Any help is greatly appreciated!

> Mark Ford

Other Threads