1. Purpose of "Public Function NewEnum() As IUnknown" - Visual Basic/VB
Hi
I'm basically wanting to intercept the For ... each mechanism to test
whether the object returned from the [_NewEnum] call fulfills a specific
criteria. If it does I want to return it, otherwise I want to recall the
[_NewEnum] until I either run out of objects or I find one with fulfills my
criteria
I'm finding that assigning an IUnknown to my own object definition is
generating a type mismatch. I thought all objects implemented IUnknown under
the hood.
Can I do it this way or will I have to implement a custom enumerator?
Here's my code
Public Property Get NewEnum() As IUnknown
Dim l_oUnknown As IUnknown
Dim l_oMyObject As CMyObject
Do
'm_cMyObjects is a VBA Collection of CMyObject
Set l_oUnknown = m_cMyObjects.[_NewEnum]
Set l_oMyObject = l_oUnknown <= generates a type mismatch
Loop While Not l_oMyObject.PassTest
Set NewEnum = l_oMyObject
End Property
Thanks
Simon
3. getting back an HREF, iUnknown, in vb.net
4. Calling a IUnknown derived COM object from VB.NET (framework 1.1 )
Hi
I have a C++ com object that exposes IStream and IPropertyBag, this is
derived from IUnknown, there is no typelib or IDispatch etc
I need to write a simple VB.NET app in VB 2003 that can create the COM
object given the CLSID, get IStream and IPropertybag from that object
then set a couple of BSTR properties, and use that IStream to read.
Can someone give me the simplest code equivalent in VB.NET to the
following in c++ (simplified for clarity)?
// {77D4C560-6A25-44af-8DA5-44FDF9B2A154}
DEFINE_GUID(CLSID_XorEncryptor, 0x77d4c560, 0x6a25, 0x44af, 0x8d,
0xa5, 0x44, 0xfd, 0xf9, 0xb2, 0xa1, 0x54);
CoInitialize(0);
CComPtr<IUnknown> pCrypt;
pCrypt.CoCreateInstance(CLSID_XorEncryptor);
CComQIPtr<IPropertyBag> pProps(pCrypt);
CComQIPtr<IStream> pCryptStream(pCrypt);
pProps->Write(...);
pProps->Write(...);
pCryptStream->Seek(...);
pCryptStream->Read(...);
Thanks in advance
Vivek
5. different between Iunknown and IDispatch In VB? - Visual Basic
6. Com interop -> IUnknown from hWnd