天天看點

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"));