Board index » cppbuilder » Problem using BCB Automation server in Visual Basic

Problem using BCB Automation server in Visual Basic

Hi everyone,

I've been trying to use a BCB automation server within Visual Basic.

If I have an automation server 'MyFirstObject' which has a method
'DoSomething' which takes as an argument a simple type such as an
integer, everything works fine.

However, if I have another automation server 'MySecondObject' with an
interface 'IMySecondObject' and I alter the method 'DoSomething' on
the first server, to take an argument of type IMySecondObject, then I
get the following error when invoking the method from Visual Basic (it
works fine under C++ Builder) :

'Run time error 438.  Object doesn't support this property or method.'

Does anyone know why this would be ?

Note:  both interfaces are dual interfaces and I made sure I
re-registered the server etc.

thanks in advance.
Phil.

 

Re:Problem using BCB Automation server in Visual Basic


You need to pass your IDisp to VB and your interface must be dual. VB
doesn't understand VTables only automation IDisp.
Quote
Phil Parker wrote:
> Hi everyone,

> I've been trying to use a BCB automation server within Visual Basic.

> If I have an automation server 'MyFirstObject' which has a method
> 'DoSomething' which takes as an argument a simple type such as an
> integer, everything works fine.

> However, if I have another automation server 'MySecondObject' with an
> interface 'IMySecondObject' and I alter the method 'DoSomething' on
> the first server, to take an argument of type IMySecondObject, then I
> get the following error when invoking the method from Visual Basic (it
> works fine under C++ Builder) :

> 'Run time error 438.  Object doesn't support this property or method.'

> Does anyone know why this would be ?

> Note:  both interfaces are dual interfaces and I made sure I
> re-registered the server etc.

> thanks in advance.
> Phil.

Re:Problem using BCB Automation server in Visual Basic


Hi Edward,  thanks for responding

Both my interfaces are dual - so they should support IDispatch.

I'm not actually passing back an interface pointer from DoSomething -
it's an IN argument.  This is the code I'm using on the VB side :

    Dim theFirst As New MyFirstObject

    Dim theSecond As New MySecondObject

    theFirst.DoSomething (theSecond)

The line it complains about is the last one.
I'm pretty puzzled why this doesn't work - any suggestions would be
appreciated.

thanks.
Phil.

On Wed, 16 Aug 2000 10:23:43 -0400, Edward Diener

Quote
<eddie...@abraxis.com> wrote:
>You need to pass your IDisp to VB and your interface must be dual. VB
>doesn't understand VTables only automation IDisp.

>Phil Parker wrote:

>> Hi everyone,

>> I've been trying to use a BCB automation server within Visual Basic.

>> If I have an automation server 'MyFirstObject' which has a method
>> 'DoSomething' which takes as an argument a simple type such as an
>> integer, everything works fine.

>> However, if I have another automation server 'MySecondObject' with an
>> interface 'IMySecondObject' and I alter the method 'DoSomething' on
>> the first server, to take an argument of type IMySecondObject, then I
>> get the following error when invoking the method from Visual Basic (it
>> works fine under C++ Builder) :

>> 'Run time error 438.  Object doesn't support this property or method.'

>> Does anyone know why this would be ?

>> Note:  both interfaces are dual interfaces and I made sure I
>> re-registered the server etc.

>> thanks in advance.
>> Phil.

Re:Problem using BCB Automation server in Visual Basic


Hi Edward,

I've since found the reason - VB diffentiates between functions and
subroutines (one has a return argument, the other doesn't) and expects
functions to be called with parentheses and subroutines to be called
without (I might have got these backwards).

If you call a method with parentheses then it will expect a return
argument and will fail if the method doesn't have a return argument (a
parameter marked with RETVAL), with the error message I mentioned.

So, all I had to do was remove the parentheses and it worked !!

Thank you Visual Basic, NOT!!

Phil.

On Wed, 16 Aug 2000 10:23:43 -0400, Edward Diener

Quote
<eddie...@abraxis.com> wrote:
>You need to pass your IDisp to VB and your interface must be dual. VB
>doesn't understand VTables only automation IDisp.

>Phil Parker wrote:

>> Hi everyone,

>> I've been trying to use a BCB automation server within Visual Basic.

>> If I have an automation server 'MyFirstObject' which has a method
>> 'DoSomething' which takes as an argument a simple type such as an
>> integer, everything works fine.

>> However, if I have another automation server 'MySecondObject' with an
>> interface 'IMySecondObject' and I alter the method 'DoSomething' on
>> the first server, to take an argument of type IMySecondObject, then I
>> get the following error when invoking the method from Visual Basic (it
>> works fine under C++ Builder) :

>> 'Run time error 438.  Object doesn't support this property or method.'

>> Does anyone know why this would be ?

>> Note:  both interfaces are dual interfaces and I made sure I
>> re-registered the server etc.

>> thanks in advance.
>> Phil.

Other Threads