Converting TCHAR to BSTR with ATL
-
I have to convert a TCHAR string to BSTR in an ATL based service without using MFC. I tried T2OLE, but I could not compile the project because some errors: '_lpa' : undeclared identifier, ... Could anyone help me out? Alma
-
You can use CComBSTR class to make this conversion. CComBSTR bstrString( tcharString ); or bstrString = tcharOtherString; With best wishes, Vita
-
I have to convert a TCHAR string to BSTR in an ATL based service without using MFC. I tried T2OLE, but I could not compile the project because some errors: '_lpa' : undeclared identifier, ... Could anyone help me out? Alma
The string conversion macros require that you put the
USES_CONVERSION;
macro at the beginning of the function/block. --Mike-- Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm -
I have to convert a TCHAR string to BSTR in an ATL based service without using MFC. I tried T2OLE, but I could not compile the project because some errors: '_lpa' : undeclared identifier, ... Could anyone help me out? Alma
Your getting this error because your not using the USES_CONVERSION macro in your functions that use the T2OLE macro. For example: void myfunc(LPTSTR szIN, BSTR* bszOut){ USES_CONVERSION; bszOut = T2OLE(szIN); } Hope that helps.
-
Your getting this error because your not using the USES_CONVERSION macro in your functions that use the T2OLE macro. For example: void myfunc(LPTSTR szIN, BSTR* bszOut){ USES_CONVERSION; bszOut = T2OLE(szIN); } Hope that helps.