Can I access more than one interface in a VBScript? 
Author Message
 Can I access more than one interface in a VBScript?

Hi, fellow developers!

I'm developing a series of ATL COM objects in C++, and most implement
two interfaces.

One interface (say IMySubject) is typically common to these objects, but
I want the objects' other interface (say IMyApp, IMyProject, IMyFile) to
be the default one.

How can I in VBScript (through the Windows Scripting Host) get access to
the *common* interface (which is not the default one exposed through
IDispatch)?  

Or asked in a more general way, does the IDispatch method of late
binding used by VBScript limit me to using only one interface per
object?

I have tried inheriting the "particular" interfaces (say IMyApp,
IMyProject, IMyFile) from IMySubject (because that makes sense to me),
but MIDL gives me an error when generating the typelib for the objects.
Is it at all possible to inherit from an interface that already inherits
from IDispatch?

Are there tricks to work around this?  Or am I misunderstanding
something completely?

I've thought of adding a Value (default) property to IMyApp (and the
others) which creates and returns an object which implements IMySubject,
but this makes it difficult for me to reuse code.

I'd appreciate it if replies were also e-mailed directly to me.

--

Technoguide AS: http://www.*-*-*.com/
Tel: +47 22510463  Fax: +47 22734749
Private: http://www.*-*-*.com/ ~rsc
Tel: +47 22606076

    jeg lukker et oye og ser halvt
    jeg  lukker begge  og ser  alt            -- seigmen



Sun, 09 Sep 2001 03:00:00 GMT  
 Can I access more than one interface in a VBScript?
Check out www.sellsbrothers.com that has some stuff regarding exposing more
than one IDispatch interface to scripting clients. But, Beware though that
its not a good practice to provide more than one implementation of IDispatch
interface from the same coclass.

--
Girish Bharadwaj [VC++/MVP].
Please Dont send email queries to me .Post them on the newsgroups.
Thank you


Quote:
> Hi, fellow developers!

> I'm developing a series of ATL COM objects in C++, and most implement
> two interfaces.

> One interface (say IMySubject) is typically common to these objects, but
> I want the objects' other interface (say IMyApp, IMyProject, IMyFile) to
> be the default one.

> How can I in VBScript (through the Windows Scripting Host) get access to
> the *common* interface (which is not the default one exposed through
> IDispatch)?

> Or asked in a more general way, does the IDispatch method of late
> binding used by VBScript limit me to using only one interface per
> object?

> I have tried inheriting the "particular" interfaces (say IMyApp,
> IMyProject, IMyFile) from IMySubject (because that makes sense to me),
> but MIDL gives me an error when generating the typelib for the objects.
> Is it at all possible to inherit from an interface that already inherits
> from IDispatch?

> Are there tricks to work around this?  Or am I misunderstanding
> something completely?

> I've thought of adding a Value (default) property to IMyApp (and the
> others) which creates and returns an object which implements IMySubject,
> but this makes it difficult for me to reuse code.

> I'd appreciate it if replies were also e-mailed directly to me.

> --

> Technoguide AS: http://www.technoguide.no
> Tel: +47 22510463  Fax: +47 22734749
> Private: http://www.nvg.unit.no/~rsc
> Tel: +47 22606076

>     jeg lukker et oye og ser halvt
>     jeg  lukker begge  og ser  alt            -- seigmen



Sun, 09 Sep 2001 03:00:00 GMT  
 Can I access more than one interface in a VBScript?
I would also recommend the same site http://www.sellsbrothers.com/tools/

To answer the questions too:
You're limited to one dispinterface per object which means one dual too.
The solutions are listed on the above site. This is COM limitation, not one
imposed by VBScript.
You CAN derive from the common dual interface and that might be the best
temporary solution. This isn't extensible though. You have to post the IDL
code to get help with correcting the errors.

--
===============================
Alexander Nickolov
STL Panasonic

===============================

Quote:

>Hi, fellow developers!

>I'm developing a series of ATL COM objects in C++, and most implement
>two interfaces.

>One interface (say IMySubject) is typically common to these objects, but
>I want the objects' other interface (say IMyApp, IMyProject, IMyFile) to
>be the default one.

>How can I in VBScript (through the Windows Scripting Host) get access to
>the *common* interface (which is not the default one exposed through
>IDispatch)?

>Or asked in a more general way, does the IDispatch method of late
>binding used by VBScript limit me to using only one interface per
>object?

>I have tried inheriting the "particular" interfaces (say IMyApp,
>IMyProject, IMyFile) from IMySubject (because that makes sense to me),
>but MIDL gives me an error when generating the typelib for the objects.
>Is it at all possible to inherit from an interface that already inherits
>from IDispatch?

>Are there tricks to work around this?  Or am I misunderstanding
>something completely?

>I've thought of adding a Value (default) property to IMyApp (and the
>others) which creates and returns an object which implements IMySubject,
>but this makes it difficult for me to reuse code.

>I'd appreciate it if replies were also e-mailed directly to me.

>--

>Technoguide AS: http://www.technoguide.no
>Tel: +47 22510463  Fax: +47 22734749
>Private: http://www.nvg.unit.no/~rsc
>Tel: +47 22606076

>    jeg lukker et oye og ser halvt
>    jeg  lukker begge  og ser  alt            -- seigmen



Sun, 09 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Access to multiple interfaces of an ATL component from VBScript

2. Accessing interfaces in VBScript

3. Access to multiple interfaces of an ATL component from VBScript

4. writing more than one vbscript statement in one line

5. Accessing non-default interfaces

6. Accessing custom COM interface

7. Accessing Multiple Interfaces

8. Accessing non-default interfaces

9. Accessing data through a OLE interface (ocx file)

10. Accessing data through a OLE interface (ocx file)

11. Interfacing with Access object using WSC written in JScript

12. Accessing COM objects and interfaces using JScript.

 

 
Powered by phpBB® Forum Software