I don't think so.
I haven't done may C++ com objects that return strings but I am pretty sure
that you have to return the value by using pointers to VARIANT. That's what
the methods I created used do and they work.
Here are the key parts of a working function that returns a single string
( I've removed some code that doesn't affect returning the string):
STDMETHODIMP CHTTPDloader::ASyncGet(BSTR strTargetURL, BSTR strDestDir, long
nOptions, VARIANT* strDownloadID)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
USES_CONVERSION;
ASSERT( strDownloadID != NULL );
if( strDownloadID == NULL )
{
return( E_POINTER );
}
try
{
CString strURL;
CString strDestination;
COleVariant vtOut;
strURL = OLE2T( strTargetURL );
strDestination = OLE2T( strDestDir );
//clear any existing value
vtOut.Attach( *strDownloadID );
vtOut.Clear();
vtOut.Detach();
strDownloadID->vt = VT_BSTR;
strDownloadID->bstrVal = (DoAsyncGet( strURL, strDestination,
nOptions )).AllocSysString();
}
catch(...)
{
return E_FAIL;
}
return S_OK;
}
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"MeAndI" <se******@libero.it> wrote in message
news:P1**********************@twister2.libero.it.. .
Hi to all,
I've integrate a custom ActiveX (builded in C++) in my ASP pages, but now
I have a question/problem.
I have a function which uses the pointers as parameters.
When I call this function in my ASP page I have this error (Data type
missmatch..)
e.g.
dim param1
dim param2
param1 = ""
param2 = ""
retval = myActiveX.myFunction (param1, param2)
myFunction is declared as follow:
long CmyActiveXCtrl::myFunction(BSTR FAR* param1, BSTR FAR* param2)
It is possible to call this function without making changes to the ActiveX
source code?
Please help
Thanks