Re: Add, Remove, Clear method of collection

Tech-Archive recommends: Fix windows errors by optimizing your registry



Brian Muth wrote:
Which interface are you talking about?



Sorry for less information.
I'm talking about the ATL collection/enumeration implementations.

For example, I have an interface names ILinks.

interface ILinks : IDispatch{
[id(1), helpstring("method Add")] HRESULT Add([in] IDispatch* item);
[id(2), helpstring("method Remove")] HRESULT Remove([in] long pos);
[propget, id(3), helpstring("property Count")] HRESULT Count([out, retval] LONG* pVal);
[propget, id(DISPID_VALUE), helpstring("property Item")] HRESULT Item([in] LONG pos, [out, retval] VARIANT* pVal);
[propget, restricted, id(DISPID_NEWENUM), helpstring("property _NewEnum")] HRESULT _NewEnum([out, retval] IUnknown** ppunk);
};

I realize that the Count, Item and _NewEnum must be exactly as above
to make it act as a collection and enumeration, and compatible
with automation which enables interoperations with VB and script.

But I can find anything detail about the Add and Remove method.
Does it mean that I can have arbitrary definitions of Add and/or Remove as which I have done above?
Or it must be in some kind of fixed forms I cannot violate just like the Count, Item and _NewEnum?

Johnson Lau
.



Relevant Pages

  • How to pass an object from C++
    ... STDMETHODIMP CSyntaxObj::InitRules(Handle_DS handlDS, BSTR Provider, BSTR ... interface IParamItem: IUnknown ... [propget, helpstring] ... HRESULT mOrigParam; ...
    (microsoft.public.vc.mfc)
  • Compiler error in idl file
    ... interface IParamItem: IUnknown ... [propget, helpstring] ... HRESULT mOrigParam(BSTR *pVal); ...
    (microsoft.public.vc.mfc)
  • Re: Compiler error in idl file
    ... interface IParamItem: IUnknown ... [propget, helpstring] ... HRESULT mOrigParam(BSTR *pVal); ...
    (microsoft.public.vc.mfc)