Test Foro de elhacker.net SMF 2.1

Programación => Programación C/C++ => Mensaje iniciado por: 70N1 en 12 Octubre 2013, 15:22 PM

Título: convertir STRING ^ a LPCWSTR
Publicado por: 70N1 en 12 Octubre 2013, 15:22 PM
Necesito llamara una funcion, y su entrada es LPCWSTR y quiero introducir los datos desde un textbox.

Alquien sabe?
Título: Re: convertir STRING ^ a LPCWSTR
Publicado por: ecfisa en 13 Octubre 2013, 01:09 AM
Hola 70N1.

De string a LPCWSTR:

Código (cpp) [Seleccionar]
...
 std::string str  = "un texto";
 LPCWSTR LPSTR = (LPCWSTR)str.c_str();
...


Saludos :)
Título: Re: convertir STRING ^ a LPCWSTR
Publicado por: Eternal Idol en 13 Octubre 2013, 01:23 AM
Deberia ser con std::wstring.
Título: Re: convertir STRING ^ a LPCWSTR
Publicado por: BloodSharp en 13 Octubre 2013, 17:38 PM
Para convertir String^ a PWCHAR tenés que usar la clase Marshall:
http://msdn.microsoft.com/en-us/library/vstudio/bb384865(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/bb384859.aspx
http://msdn.microsoft.com/en-us/library/vstudio/bb531313(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/42zy2z41.aspx


B#