title: Having trouble converting from string to LPCTSTR
body: <p>I am trying to put some text in a Static Text widget, like this:</p>
  
  <pre><code>m_StartupTime.SetWindowText(someStringVariable);
  </code></pre>
  
  <p>And get an error:</p>
  
  <blockquote>
    <p>'CWnd::SetWindowTextA' : cannot convert parameter 1 from 'std::string' to 'LPCTSTR'</p>
  </blockquote>
  
  <p>I have tried using the <code>c.str()</code> method, but when I do, the program compiles fine, but crashes at run-time, throwing an error:</p>
  
  <p><img src="https://i.stack.imgur.com/dnQVG.jpg" alt="The error"></p>
  
  <p>So I'm figuring out if the problem is related to the conversion, or anything other than that?</p>
  
  <p>Using CString doesn't solve the problem, and I have tried switching from Unicode charcter set to Multi-Byte, with no success. Oh, I am developing in MFC.</p>
  
  <p>EDIT: Found a solution! I used the CString class.</p>
  
  <pre><code>string a = "smth";
  CString str(a.c_str());
  </code></pre>