title: UTF-8 From File to TextBox VC++ 6.0
body: <p>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).</p>
  
  <p>I read a line into CString strStr, then used this code:</p>
  
  <pre><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);
  </code></pre>
  
  <p>Still not sure how I would get it into a textbox, but it turns out I don't need to do that anyway.</p>