天天看点

A2W and string2W _T()

USES_CONVERSION;
	char*  LineChar = "helloworld";
	const WCHAR* cLineChar = A2W(LineChar);


	string partPaths = "water";
	const char* partChar = partPaths.c_str();
	std::wstring widstr = std::wstring(partPaths.begin(), partPaths.end());
	wchar_t* pwidstr = const_cast(widstr.c_str());
           

MFC中MessageBox()函数的第一个参数类型就是 WCHAR*, _T是为了支持中文

                USES_CONVERSION;
		char*  LineChar = "受任于败军之际,\
				奉命于危难之间";
		const WCHAR* cLineChar = A2W(LineChar);
		MessageBox(cLineChar, _T("show"));