Post the IDL definition of AnItem within its interface. BTW, I
assume this is an ATL question.

Signature
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
> OK. There is definitely an AnItem property in ACollection. Here's the
> code:
[quoted text clipped - 51 lines]
>> IDE
>> and paste it into the message.
> Post the IDL definition of AnItem within its interface.
// Primary dispatch interface for CACollection
[
object,
version(2.0),
odl,
uuid("64E4B5B8-866A-4598-9F43-935EA6942FF5"),
dual,
hidden,
nonextensible,
oleautomation,
pointer_default(unique)
]
interface _IDualACollection : IDispatch
{
[propget, id(1)]
HRESULT Count([out, retval] long* num);
[propget, id(2), helpstring("An object")]
HRESULT AnItem([in]long num, [out, retval]_IDualAnItem** pdp);
[id(3), helpstring("Adds an object")]
HRESULT Add([in] long number, [in] long number, [out,
retval]_IDualAnItem** prop);
[id(4)]
HRESULT Remove([in] long num);
[propget, restricted, id(DISPID_NEWENUM)]
HRESULT _NewEnum([out, retval] IUnknown** ppienum);
}
>BTW, I assume this is an ATL question.
Well, I guess not strictly. The server is written using ATL but it's the
client (VB)
giving the error. I just thought that many ATL developers use VB as test
clients
and may have seen this error before.
Thanks,
Drew
>> OK. There is definitely an AnItem property in ACollection. Here's the
>> code:
[quoted text clipped - 51 lines]
>>> IDE
>>> and paste it into the message.
Alexander Nickolov - 19 Apr 2005 00:45 GMT
Looks fine to me... Can you try to do dereferencing in steps
and see where it starts failing? E.g.
set col = MyIF.Collection
set item = col.AnItem(13)
let item.AProperty = EnumMember

Signature
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
>> Post the IDL definition of AnItem within its interface.
>
[quoted text clipped - 93 lines]
>>>> the IDE
>>>> and paste it into the message.
Drew Myers - 19 Apr 2005 17:52 GMT
It looks like it's just not possible to set a property using this syntax:
MyIF.ACollection.AnItem(1).AProperty = EnumMember
This, however:
Set item = MyIF.ACollection.AnItem(1)
item.AProperty = EnumMember
works.
Thanks for your help,
Drew
> Looks fine to me... Can you try to do dereferencing in steps
> and see where it starts failing? E.g.
>
> set col = MyIF.Collection
> set item = col.AnItem(13)
> let item.AProperty = EnumMember
Brian Muth - 19 Apr 2005 21:05 GMT
I just whipped up a VB6 DLL which implements a collection of objects. I can
assure you that it is quite valid to use:
MyIF.ACollection.AnItem(1).AProperty = EnumMember
and if it can be done in VB6, it can certainly be done with an ATL COM
implementation. Note that if EnumMember is an object, the syntax needs to be
Set MyIF.ACollection.AnItem(1).AProperty = EnumMember
You might want to do the same, then dump the IDL that VB6 creates, and see
how it compares with yours...
HTH
Brian