Board index » cppbuilder » Aargh... What is this suposed to mean ??? (BCB4)

Aargh... What is this suposed to mean ??? (BCB4)

Hello,

I wonder if somebody could help me regarding the following error that
appears upon running a BCB4 project, that has an automation object
implemented :

    IsBound() @ d:\bcb\emuvcl\utilcls.h/2410
    Press(Y)es to terminate, (N)o to continue and (C)ancel to Debug

<... thunderstrike at a clear sky ...>

Clicking cancel brings me in the de{*word*81}, and takes me to the
sysvari.h file, on the line as indicated hereafter with an arrow.

  template <class P1>
  void Variant::OleProcedure(const String& name, P1 p1)
  {
    TAutoArgs<1> args;
    args[1] = p1;
->  OleProcedure(name, static_cast<TAutoArgsBase*>(&args));
  }

Help please !

Lieven.

 

Re:Aargh... What is this suposed to mean ??? (BCB4)


try yourobj.Bind("somekey");  where "somekey" is whatever...
Quote
Lieven Tomme wrote in message <36f90997.19842...@news.eunet.be>...
>Hello,

>I wonder if somebody could help me regarding the following error that
>appears upon running a BCB4 project, that has an automation object
>implemented :

>    IsBound() @ d:\bcb\emuvcl\utilcls.h/2410
>    Press(Y)es to terminate, (N)o to continue and (C)ancel to Debug

><... thunderstrike at a clear sky ...>

>Clicking cancel brings me in the de{*word*81}, and takes me to the
>sysvari.h file, on the line as indicated hereafter with an arrow.

>  template <class P1>
>  void Variant::OleProcedure(const String& name, P1 p1)
>  {
>    TAutoArgs<1> args;
>    args[1] = p1;
>->  OleProcedure(name, static_cast<TAutoArgsBase*>(&args));
>  }

>Help please !

>Lieven.

Re:Aargh... What is this suposed to mean ??? (BCB4)


Thanks for your hint, Chris. It brought me back onto my source code,
making me discover a line being commented out :(  Shame on me ...
Anyway, I got further on the road. I am stuck now on a point where
Robert Chafer seems to have ended up in his article posted in
news://borland.public.cppbuilder.language on march 10.

To quote him ... :

"I use Word to produce reports from my app. I use Variants to drive
Word and am really impressed with the functionality. However, my BCB3
code just DOES NOT COMPILE, giving all sorts of template compiler
errors deep inside a BCB4 include file (a fuller description can be
found in the ActiveX forum, look for 'making my life difficult'). I
eventually found a way to get my code to compile and now it simply
does not run and fails with an EOleSysError exception. I can not find
any mention other than 'You can create an Automation controller
by....Using the Variant::Exec method' in the manual. The help file for
Variant::Exec says that the prototype is :
Variant __fastcall Exec(AutoCmd& cmd, Integer lcid
=LOCALE_SYSTEM_DEFAULT);
AutoCmd is not a help topic and there is not jump to it in this help
topic. So my code is still broken."

And this is where I arrived too.
Is there anyone among you readers that might get me closer to my
target ?

I appreciate all help or ideas.
TIA,

Lieven

On Tue, 30 Mar 1999 13:27:26 -0600, "Chris Bordeman"

Quote
<chr...@pernet.net> wrote:
>try yourobj.Bind("somekey");  where "somekey" is whatever...

>Lieven Tomme wrote in message <36f90997.19842...@news.eunet.be>...
>>Hello,

>>I wonder if somebody could help me regarding the following error that
>>appears upon running a BCB4 project, that has an automation object
>>implemented :

>>    IsBound() @ d:\bcb\emuvcl\utilcls.h/2410
>>    Press(Y)es to terminate, (N)o to continue and (C)ancel to Debug

>><... thunderstrike at a clear sky ...>

>>Clicking cancel brings me in the de{*word*81}, and takes me to the
>>sysvari.h file, on the line as indicated hereafter with an arrow.

>>  template <class P1>
>>  void Variant::OleProcedure(const String& name, P1 p1)
>>  {
>>    TAutoArgs<1> args;
>>    args[1] = p1;
>>->  OleProcedure(name, static_cast<TAutoArgsBase*>(&args));
>>  }

>>Help please !

>>Lieven.

Re:Aargh... What is this suposed to mean ??? (BCB4)


Lieven,

There are two ways to invoke automation methods using the Variant class.
The first is by calling OleFunction or OleProcedure.  Example:

void sampleMethod1()
{
    Variant simpleVariant =
Variant::CreateObject("Objects.ProgID.Goes.Here");

    //OleFunction
    String someText = simpleVariant.OleFunction("GetSomeTextMethodName",
"Param1");
    //the method being called is "GetSomeTextMethodName" and takes one
string parameter and returns a String

    //OleProcedure
    simpleVariant.OleProcedure("SetSomeTextMethodName", "Param1");
    //the method being called is "SetSomeTextMethodName" and takes one
string parameter

Quote
}

To add more parameters just commas after each parameter (but there is a
limit on parameters using this method).  I personally do not recommend that
you use OleFunction and/or OleProcedure because there is a bug in one of
them.

The second way is by using the Exec method.  Here is an example:

void sampleMethod2()
{
    Variant simpleVariant =
Variant::CreateObject("Objects.ProgID.Goes.Here");

    //Invoking a Function
    String someText = simpleVariant.Exec(Function("GetSomeTextMethodName")
<< "Param1");
    //the method being called is "GetSomeTextMethodName" and takes one
string parameter and returns a String

    //Invoking a Procedure
    simpleVariant.Exec(Procedure("SetSomeTextMethodName") << "Param1");
    //the method being called is "SetSomeTextMethodName" and takes one
string parameter

Quote
}

You can add unlimited parameters to each call by simply placing a '<<'
between each parameter.  Which ever method you decide to use, make sure that
you use Function for when you expect something back and Procedure for when
you don't.  I hope this helps.

Mike

Quote
Lieven Tomme wrote in message <37021e6b.4339...@news.eunet.be>...
>Thanks for your hint, Chris. It brought me back onto my source code,
>making me discover a line being commented out :(  Shame on me ...
>Anyway, I got further on the road. I am stuck now on a point where
>Robert Chafer seems to have ended up in his article posted in
>news://borland.public.cppbuilder.language on march 10.

>To quote him ... :

>"I use Word to produce reports from my app. I use Variants to drive
>Word and am really impressed with the functionality. However, my BCB3
>code just DOES NOT COMPILE, giving all sorts of template compiler
>errors deep inside a BCB4 include file (a fuller description can be
>found in the ActiveX forum, look for 'making my life difficult'). I
>eventually found a way to get my code to compile and now it simply
>does not run and fails with an EOleSysError exception. I can not find
>any mention other than 'You can create an Automation controller
>by....Using the Variant::Exec method' in the manual. The help file for
>Variant::Exec says that the prototype is :
>Variant __fastcall Exec(AutoCmd& cmd, Integer lcid
>=LOCALE_SYSTEM_DEFAULT);
>AutoCmd is not a help topic and there is not jump to it in this help
>topic. So my code is still broken."

>And this is where I arrived too.
>Is there anyone among you readers that might get me closer to my
>target ?

>I appreciate all help or ideas.
>TIA,

>Lieven

>On Tue, 30 Mar 1999 13:27:26 -0600, "Chris Bordeman"
><chr...@pernet.net> wrote:

>>try yourobj.Bind("somekey");  where "somekey" is whatever...

>>Lieven Tomme wrote in message <36f90997.19842...@news.eunet.be>...
>>>Hello,

>>>I wonder if somebody could help me regarding the following error that
>>>appears upon running a BCB4 project, that has an automation object
>>>implemented :

>>>    IsBound() @ d:\bcb\emuvcl\utilcls.h/2410
>>>    Press(Y)es to terminate, (N)o to continue and (C)ancel to Debug

>>><... thunderstrike at a clear sky ...>

>>>Clicking cancel brings me in the de{*word*81}, and takes me to the
>>>sysvari.h file, on the line as indicated hereafter with an arrow.

>>>  template <class P1>
>>>  void Variant::OleProcedure(const String& name, P1 p1)
>>>  {
>>>    TAutoArgs<1> args;
>>>    args[1] = p1;
>>>->  OleProcedure(name, static_cast<TAutoArgsBase*>(&args));
>>>  }

>>>Help please !

>>>Lieven.

Re:Aargh... What is this suposed to mean ??? (BCB4)


Hello Mike,

Thanks, your help got me that far that I have been able to  invoke the
automation methods, not 100 % as you described, but at least 100%
according to your concern :

 //Invoking a Function
 String someText =
simpleVariant.Exec(Function("GetSomeTextMethodName")
<< "Param1");

produced linker errors.
I had to change it to :

 function GetSomeTextMethodName("GetSomeTextMethodName");
 String someText=simpleVariant.Exec(GetSomeTextMethodName<<"Param1");

and thus by now I am already miles further on.
I don't know what makes the difference. I encountered the above syntax
in the help manuals, and just used them. But I couldn't make it
without your help.

This project that I am porting towards BCB4 (46000 lines of source
code BTW), is supposed to have automation functionality being called
for by a BCB1 project OlePropertyGet.
In the BCB4 project, I have implemented an automation object (not a
COM object). By debugging on that side, I get into the BCB4 function
that is supposed to return data towards the calling BCB1
OlePropertyGet function.
Upon performing the actual return from within BCB4, the BCB1 client is
not receiving the data.

Solving this problem is the finishing touch for me in this huge
project.
So, I would be glad to hear once more from you experts, in which terms
I ought to think. I must be missing some ideas, I presume.
Once more, thanks to everbody for advising !

Lieven

On Wed, 31 Mar 1999 22:12:44 GMT, "Michael Gaffney" <ga...@home.com>
wrote:

Quote
>Lieven,

>There are two ways to invoke automation methods using the Variant class.
>The first is by calling OleFunction or OleProcedure.  Example:

>void sampleMethod1()
>{
>    Variant simpleVariant =
>Variant::CreateObject("Objects.ProgID.Goes.Here");

>    //OleFunction
>    String someText = simpleVariant.OleFunction("GetSomeTextMethodName",
>"Param1");
>    //the method being called is "GetSomeTextMethodName" and takes one
>string parameter and returns a String

>    //OleProcedure
>    simpleVariant.OleProcedure("SetSomeTextMethodName", "Param1");
>    //the method being called is "SetSomeTextMethodName" and takes one
>string parameter
>}

>To add more parameters just commas after each parameter (but there is a
>limit on parameters using this method).  I personally do not recommend that
>you use OleFunction and/or OleProcedure because there is a bug in one of
>them.

>The second way is by using the Exec method.  Here is an example:

>void sampleMethod2()
>{
>    Variant simpleVariant =
>Variant::CreateObject("Objects.ProgID.Goes.Here");

>    //Invoking a Function
>    String someText = simpleVariant.Exec(Function("GetSomeTextMethodName")
><< "Param1");
>    //the method being called is "GetSomeTextMethodName" and takes one
>string parameter and returns a String

>    //Invoking a Procedure
>    simpleVariant.Exec(Procedure("SetSomeTextMethodName") << "Param1");
>    //the method being called is "SetSomeTextMethodName" and takes one
>string parameter
>}

>You can add unlimited parameters to each call by simply placing a '<<'
>between each parameter.  Which ever method you decide to use, make sure that
>you use Function for when you expect something back and Procedure for when
>you don't.  I hope this helps.

>Mike

Other Threads