System::String to PWCHAR

  • Thread starter Thread starter B Vidyadhar Joshi
  • Start date Start date
B

B Vidyadhar Joshi

I have a function (a 3rd party DLL) which takes PWCHAR as one of the
arguments. The value that is supposed to be passed to this argument is got
from a Windows::Forms TextBox control which is in System::String type. How
do I convert the value of the text box to PWCHAR before passing on to the
function?

Thanks.
 
WCHAR are UNICODE characters that representation uses 2 bytes for each
characters.

You can use (api) MultiByteToWideChar() or (rtl) mbtowc() to convert.

JF Jolin
 
System::String is already Unicode.

Look for PtrToStringChars in vcclr.h.

Ronald Laeremans
Visual C++ team
 
This worked! Thanks Ronald :-)

Ronald Laeremans said:
System::String is already Unicode.

Look for PtrToStringChars in vcclr.h.

Ronald Laeremans
Visual C++ team
 
Back
Top