How the parameters passed by reference are defined in the interface method vc ATL dll 's ?

Category: VC/MFC -> ATL/ActiveX/COM Author: k286235378 Date: 2003-02-04 11:22:31
 
k286235378
2003-02-04 11:22:31
I now write a vc   ATL   com   method dll, dll interface defined in a BSTR type parameter with the
:: F1 (BSTR   tempStr1)
{
}
compiled through no problem, but if we define a parameter passed by reference method
:: F2 (BSTR   & tempStr)
{
}
compile-time system reports " expecting   a   declarator   or   *   near   " & " ", for whatever reason, may be the result I want tempStr return the calling program , how to achieve it ? Thank you !  
zhouqiuyan
2003-02-04 11:24:41
First do not need references , direct use of pointers can be.
on assignment , there are a lot of ways .
easiest way : CString   a = " asfsd ";
CComBSTR   b = a.AllocSysString ();
tempStr = b.copy (); can be.
If you are Unicode compiler , you can directly CComBSTR   b = L " asfsd ";
fskull
2003-02-04 11:33:46
Do not return the parameters inside .
[propget,   id (10),   helpstring (" method   GetVersion ")]   HRESULT   GetVersion ([out, retval]   BSTR   * bstrVersion);
DUANLINADUANLINA123
2003-02-04 11:36:09
made ​​after activx controls, the generated class , declare this function is :
CString   get_GetVersion ()
{
CString   result;
InvokeHelper (0xa,   DISPATCH_PROPERTYGET,   VT_BSTR,   (void *) & result,   NULL);
return   result;
}
sterode
2003-02-04 11:55:22
Thank you define success , but how tempStr assignment to it?
tempStr   =   " abcd ";   compilation error. How to write?
sorry, I vc relatively weak , thank you enlighten