'hidden' interface IUnknown 
Author Message
 'hidden' interface IUnknown

I noticed per  'accidance' that VB recognises and even compiles this

Sub MySub (punk As IUnkown)
End SUb

Does anybody know to do something usefull with it?

Regards,

Egbert



Sat, 18 Jan 2003 03:00:00 GMT  
 'hidden' interface IUnknown
Sure.  The first thing that comes to mind is when you want to take COM
objects as parameters, including objects that don't implement IDispatch.  An
object like this could be written in C++.  You could use Variant, but then
the client could pass in integers, etc.


Quote:
> I noticed per  'accidance' that VB recognises and even compiles this

> Sub MySub (punk As IUnkown)
> End SUb

> Does anybody know to do something usefull with it?

> Regards,

> Egbert



Sat, 18 Jan 2003 03:00:00 GMT  
 'hidden' interface IUnknown
OK but does that mean that VB can do queryinterface?


Quote:
> Sure.  The first thing that comes to mind is when you want to take COM
> objects as parameters, including objects that don't implement IDispatch.
An
> object like this could be written in C++.  You could use Variant, but then
> the client could pass in integers, etc.



> > I noticed per  'accidance' that VB recognises and even compiles this

> > Sub MySub (punk As IUnkown)
> > End SUb

> > Does anybody know to do something usefull with it?

> > Regards,

> > Egbert



Sat, 18 Jan 2003 03:00:00 GMT  
 'hidden' interface IUnknown

Of course!  That's what the Set keyword is for:

Dim obj As MyClass
Dim iface As IMyInterface

Set iface = obj   'this is calling QueryInterface


Quote:
> OK but does that mean that VB can do queryinterface?



> > Sure.  The first thing that comes to mind is when you want to take COM
> > objects as parameters, including objects that don't implement IDispatch.
> An
> > object like this could be written in C++.  You could use Variant, but
then
> > the client could pass in integers, etc.



> > > I noticed per  'accidance' that VB recognises and even compiles this

> > > Sub MySub (punk As IUnkown)
> > > End SUb

> > > Does anybody know to do something usefull with it?

> > > Regards,

> > > Egbert



Sat, 18 Jan 2003 03:00:00 GMT  
 'hidden' interface IUnknown

Not directly using IUnknown, but this is equivalent:
Dim xxx As ISomeInterface
Set xxx = New ISomeInterface


Quote:
> OK but does that mean that VB can do queryinterface?



> > Sure.  The first thing that comes to mind is when you want to take COM
> > objects as parameters, including objects that don't implement IDispatch.
> An
> > object like this could be written in C++.  You could use Variant, but
then
> > the client could pass in integers, etc.



> > > I noticed per  'accidance' that VB recognises and even compiles this

> > > Sub MySub (punk As IUnkown)
> > > End SUb

> > > Does anybody know to do something usefull with it?

> > > Regards,

> > > Egbert



Sat, 18 Jan 2003 03:00:00 GMT  
 'hidden' interface IUnknown
Hopefully it was obvious that I forgot to instantiate obj first... d'oh!


Quote:
> Of course!  That's what the Set keyword is for:

> Dim obj As MyClass
> Dim iface As IMyInterface

> Set iface = obj   'this is calling QueryInterface



> > OK but does that mean that VB can do queryinterface?



> > > Sure.  The first thing that comes to mind is when you want to take COM
> > > objects as parameters, including objects that don't implement
IDispatch.
> > An
> > > object like this could be written in C++.  You could use Variant, but
> then
> > > the client could pass in integers, etc.



> > > > I noticed per  'accidance' that VB recognises and even compiles this

> > > > Sub MySub (punk As IUnkown)
> > > > End SUb

> > > > Does anybody know to do something usefull with it?

> > > > Regards,

> > > > Egbert



Sun, 19 Jan 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. 'Help-Find'-style interface for vb4 programmed database search

2. 'Help-Find'-style interface for vb4 programmed database search

3. class doesn't support automation or doesn't support expected interface

4. Hiding the 'New' Record

5. Hiding 'read only' check box

6. Hiding Fields 'on the fly'

7. Hiding the 'New' Record

8. Implementing IUnknown interface in Access 2000 class

9. Exposing NEWENUM IUNKNOWN interface from a VBA Class mOdule

10. Cannot implement interface in VB with IUnknown retval

11. Interfaces IUnknown

12. How to implement Interfaces with Propertys returning IUnknown????

 

 
Powered by phpBB® Forum Software