-
hiding interfaces in COM
Hey all,
I want to hide the Interfaces so that they do not show up when i create them in VB. I'm aggregating for example object bar into object Foo. When I add a reference to foo.dll in VB and try to create the object using createobject intellisense shows foo.IBar which I don't want to show up, but when I use new it does not How would I hiding the IBar interface from VB?
Thanks!
hope this is not too confusing.
-
Azh,
You can't hide an Interface in COM. The implementation of a COM component is only accessable through its interfaces. You don't see the Interface when you use the New keyword because you can't instantiate an Interface.
-
Code:
Dim oCar as New CCar
Dim oVehicle as IVehicle
Set oVehicle = oCar
-
-
actually it can be done
you can use the hidden keyword in the idl to "hide" the interfaces you do not want the user to see.
-
You're right about the 'hide' keyword, but then you should define your interfaces in IDL compile it to get the TypeLib and use it in VB.
So only in VB it's not possible !!
By the way, 'as new' you shouldn't use !!
(Your component will be instantiated by the VB Runtime and not COM)