You can't do this from VBScript.
A COM object has a number of interfaces. If I create a COM object called
MyProject.MyClass that has an interface called IMyInterface then your COM
class has;
IUnknown - this lets any client query the object for a reference count and
to see what interfaces it supports
IDispatch - this is a list of functions the object supports that allows
late-binding via querying for a function by name.
_MyClass - this contains all public methods on MyClass and is called the
default interface. It is implemented for you under the covers by VB.
IMyInterface - this contains all public methods on IMyInterface.
When VB is the client of a COM object it can see and use *all* of these
interfaces. However VBScript is limited to IUnknown (all COM objects have
this and all COM clients must understand it) and IDispatch.
So VBScript clients can only use late binding for COM and/or the default
interface. So why can it see your public methods that are in _MyClass?
Because it is up to whatever builds the COM object to decide what goes in
IDispatch and the VB compiler chooses to only put the public methods in your
default interface into IDispatch. It will not put the methods in
IMyInterface into IDispatch.
In a nut-shell that is why you can't access custom interfaces on your VB
objects from VBScript.
[quoted text, click to view] "Andy Ranoe" <andy.ranoe@ntlworld.com> wrote in message
news:f9q_b.2259$Vv.1861@newsfe2-gui.server.ntli.net...
> I have just started playing about with interface inheritance using the
> 'Implements' thing
>
> All works fine in the VB proper because you go ...
>
> Dim xObj as ILib.IClass
> .....
> .....
> Set xObj = CreateObject("Lib.Class")
>
> and this makes the connections between the interface definitions and their
> implementations
>
> How do I do this in VBScript ???
>
> When you Set xObj = CreateObject("Lib.Class")
>
> - the concrete class Lib.Class doesn't have the properties and methods
> - can't use the DIM statement to tie up with the interface
>
> ----So what do I have to do
>
>
> TIA
>
> Andy
>
>