Board index » cppbuilder » Sending back a collection object

Sending back a collection object

I am a newbie in COM, and I am looking for the way to create a method that
returned for the result an object collection of strings. Can someone have a
sample for doing that ?
Thanks.

Sam

 

Re:Sending back a collection object


Take a look at tip #16 (IEnumVariant) at
http://www.techvanguards.com/com/tutorials/tips.asp

Quote
> I am a newbie in COM, and I am looking for the way to create a method that

returned for the result an object collection of strings.

Re:Sending back a collection object


I am sorry, but I was not accurate for my needs:
I am looking for the way to create a method that returned for the result an
Quote
>array of strings<.

For example I need some thing like that:
STDMETHODIMP TCustomToolsImpl::GetArrayOfStringsOut(BSTR* Value
/*ou,retval]*/)
{
   char *array[3]={{"sunday"},{"monday"},{"tuesday"}};
   *Value=(Variant)array;

Quote
}

And use this array in JScript after.
How writing correctly the mlethod ?

"Nelson Altimari" <nospam@me> a crit dans le message news:
3ca5b7db$1_2@dnews...

Quote
> Take a look at tip #16 (IEnumVariant) at
> http://www.techvanguards.com/com/tutorials/tips.asp

> > I am a newbie in COM, and I am looking for the way to create a method
that
> returned for the result an object collection of strings.

Re:Sending back a collection object


I'm not sure about as a result, but that is possible using the SAFEARRAY
construct. Look at variants, OleVariants, and the like. You can pass these
as out parameters.

Quote
"sam" <skne...@wanadoo.fr> wrote in message news:3ca6d411$1_2@dnews...
> I am sorry, but I was not accurate for my needs:
> I am looking for the way to create a method that returned for the result
an
> >array of strings<.
> For example I need some thing like that:
> STDMETHODIMP TCustomToolsImpl::GetArrayOfStringsOut(BSTR* Value
> /*ou,retval]*/)
> {
>    char *array[3]={{"sunday"},{"monday"},{"tuesday"}};
>    *Value=(Variant)array;
> }

> And use this array in JScript after.
> How writing correctly the mlethod ?

> "Nelson Altimari" <nospam@me> a crit dans le message news:
> 3ca5b7db$1_2@dnews...
> > Take a look at tip #16 (IEnumVariant) at
> > http://www.techvanguards.com/com/tutorials/tips.asp

> > > I am a newbie in COM, and I am looking for the way to create a method
> that
> > returned for the result an object collection of strings.

Other Threads