|
 |
asp_components thread: Passing variable number of parameters to a C++ Component from ASP
Message #1 by "Tom McMillen" <tom.mcmillen@e...> on Mon, 11 Jun 2001 11:56:06
|
|
Hi,
I'm trying to write a component in C++ that will take a variable number of
(string) arguments and returns an encoded version of the string (a bit
like using a ParamArray in VB)
However I have been unable to find any examples on how to do this. Can
anyone point me in the right direction, or give any examples?
Thanks....
The code I have is
IDL:
[vararg, id(20), helpstring("method EncodeArgs")]
HRESULT EncodeArgs([in] SAFEARRAY(VARIANT) *args,
[out, retval] BSTR* pbstrEncoded);
header file:
STDMETHOD(EncodeArgs)(/*[in]*/ SAFEARRAY *args,
/* [out, retval] */);
Message #2 by "Shin Kyoun Choi" <shinkyoun@y...> on Tue, 19 Jun 2001 13:33:42
|
|
What about like this.......
IDL:
[vararg, id(20), helpstring("method EncodeArgs")]
HRESULT EncodeArgs([in] VARIANT *args,
[out, retval] BSTR* pbstrEncoded);
header file:
STDMETHOD(EncodeArgs)(/*[in]*/ VARIANT *args,
Then
code like this
- first check if the 'args' parameter is array like this : args->vt ==
VT_ARRAY
- then retrieve array pointer like this : psa = args->parray;
(psa :SafeArray pointer)
- then access the data in the SafeArray using SafeArrayAccessData
|
|
 |