How do I get an old VC++ 6.0 MFC program to read and display UTF8 in a TextBox or MessageBox? Preferably without breaking any of the file reading and displaying that is currently written in there (fairly substantial).
I read a line into CString strStr, then used this code:
int nLengthNeeded = MultiByteToWideChar(CP_UTF8,0,strStr,1024,0,0);
wchar_t * pWCMessage = new wchar_t[ nLengthNeeded ];
MultiByteToWideChar(CP_UTF8,0,strStr,1024,pWCMessage,nLengthNeeded);
nLengthNeeded = MultiByteToWideChar(CP_UTF8,0,"Error Title",50,0,0);
wchar_t * pWCTitle = new wchar_t[ nLengthNeeded ];
MultiByteToWideChar(CP_UTF8,0,"Error Title",50,pWCTitle,nLengthNeeded);
MessageBoxW(NULL,pWCMessage,pWCTitle,MB_ICONINFORMATION);
Still not sure how I would get it into a textbox, but it turns out I don't need to do that anyway.