可能重複:
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