Can VB accept an IUnknown parameter when called from a VC++ client using a method?
Printable View
Can VB accept an IUnknown parameter when called from a VC++ client using a method?
Hi there,
I think you can pass an IUnknown Parameter into VB. Emphasis on the word..."think" :)
The reason for this is that the collection class in VB has a _NewEnum Function that is of an IUnknown type. When I create a Collection component DLL and I wrap the functions and methods on an intrinsic Collection class in my component, I need to write a _NewEnum as an IUnknown Function. This function has a hidden property and cant be seen from the client and this is meant for use for client needing to call the collection class thru the use of For Each Ship in Ships...Next.
If this IUnknown function is not included, you cant use the For Each...Next Loop. Instead you have to use the For i = 0 to Ships.Count...Next Loop which, I think, is less elegant.
Therefore, I think you can pass an IUnknown Parameter into VB.
Function _NewEnum() As Unknown
After hacking away at the problem, we found that we could passed the IUnknown on the client side as a VARIANT. The VB server was then able to get the IUnknown.
Thanks