by Adolfo » Thu Aug 28, 2014 11:01 pm
Antonio...
Mirando algunas soluciones para mi problema, encontre esto
std::string ConvertWCSToMBS(const wchar_t* pstr, long wslen)
{
int len = ::WideCharToMultiByte(CP_ACP, 0, pstr, wslen, NULL, 0, NULL, NULL);
std::string dblstr(len, '\0');
len = ::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
pstr, wslen /* not necessary NULL-terminated */,
&dblstr[0], len,
NULL, NULL /* no default char */);
return dblstr;
}
Y aqui de BSTR a STR, posibles 3
//----------------------
#include <comdef.h>
std::string myString = _bstr_t (myBSTR);
//----------------
void f(BSTR ms_str)
{
std::wstring ws(ms_str);
}
//*---------------
BSTR ConvertMBSToBSTR(const std::string& str)
{
int wslen = ::MultiByteToWideChar(CP_ACP, 0 /* no flags */,
str.data(), str.length(),
NULL, 0);
BSTR wsdata = ::SysAllocStringLen(NULL, wslen);
::MultiByteToWideChar(CP_ACP, 0 /* no flags */,
str.data(), str.length(),
wsdata, wslen);
return wsdata;
}
Que me dices.. no soy experto en C, pero este problema me tiene acogotado.
Saludos..
De ahi busco las opciones de recibir bien el VARIANT_BOOL
;-) Ji,ji,ji... buena la cosa... "all you need is code"
http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650