_bstr_t example("Hello world");
void Callsomemethod(CString y);
Callsomemethod(T2OLE(example)); //This is where I need to replace T2OLE
CString assumes you are passing TCHAR*
compatible argument, whereas x2OLE
macro gives you WCHAR*
- you are using opposite direction conversion macro. And there might be missing conversion between CString
and helper CA2W
classes, where you need to help by providing a cast.
_bstr_t example("Hello world");
void Callsomemethod(CString y);
//void Callsomemethod(LPCTSTR y);
Callsomemethod(CString(example));
Callsomemethod(CString((BSTR) example));
Callsomemethod(OLE2CT(example));
Callsomemethod((LPCTSTR) OLE2CT(example));