可能重复:
C++ std::string conversion problem on Windows
How to convert std::string to LPCSTR?字符串到LPCTSTR
我想重新命名一个窗口(WM_SETTEXT)到别的东西。有一个包含新窗口名称的std :: string。我需要将std :: string转换为“LPCTSTR”,这是因为SendMessage需要“LPCTSTR”中的名称。
我不能得到这个工作,有人可以帮我把字符串转换为LPCTSTR吗?
可能的[Windows上的C++ std :: string转换问题](http://stackoverflow.com/questions/874433/c-stdstring-conversion-problem-on-windows)或http:// stackoverflow的重复。 com/questions/1200188/how-to-convert-stdstring-to-lpcstr,或者本页面上其他相关的其他问题。 – Mat 2012-03-25 18:16:42
您的程序是以Unicode还是ANSI模式编译的?这会影响'LPCTSTR'的真实含义。 – 2012-03-25 18:18:00
使用SetWindowTextA()是快速修复。 – 2012-03-25 19:38:04