A
Aaron Queenan
I have the following in the idl for a COM collection:
[propget, id(DISPID_VALUE), helpstring("property Item")] HRESULT
Item([in] VARIANT* Index, [out, retval] LPDISPATCH* punk);
This allows VBA to access objects in the collection using the syntax
collection("key") or collection(1).
When I import this type library into C#, the DISPID_VALUE property appears
as 'this[]', and when I try to use the syntax similar to VBA, the compiler
complains that I must use collection.get_Item() instead of collection().
1. How should I form the idl so that I can use the collection.Item[]
syntax, as I would be able to if I didn't use DISPID_VALUE?
2. If I use the collection.get_Item() syntax, I must convert the Index
parameter to an 'object ref', and the method returns an object. How should
I change the idl so that the method accepts a 'string' and returns the
correct object type?
Thanks,
Aaron Queenan.
[propget, id(DISPID_VALUE), helpstring("property Item")] HRESULT
Item([in] VARIANT* Index, [out, retval] LPDISPATCH* punk);
This allows VBA to access objects in the collection using the syntax
collection("key") or collection(1).
When I import this type library into C#, the DISPID_VALUE property appears
as 'this[]', and when I try to use the syntax similar to VBA, the compiler
complains that I must use collection.get_Item() instead of collection().
1. How should I form the idl so that I can use the collection.Item[]
syntax, as I would be able to if I didn't use DISPID_VALUE?
2. If I use the collection.get_Item() syntax, I must convert the Index
parameter to an 'object ref', and the method returns an object. How should
I change the idl so that the method accepts a 'string' and returns the
correct object type?
Thanks,
Aaron Queenan.