2012/03/01

const char * => LPWSTR 変換

変換マクロを使えば簡単。
#include <atlconv.h>
...
USES_CONVERSION;  // コインパイルエラーを避ける為のマクロ

std::string str = "Hello, world!";
CA2W pszWide(str.c_str());

// または直接
LPWSTR x = CA2W(str.c_str());
UTF-8なら
CA2W pszWide(str.c_str(), CP_UTF8);

参考/引用

0 件のコメント:

コメントを投稿