txw888\colorbtn.cpp(93): error C2664: “void CColorButton::DrawButtonText(CDC *,CRect,const char *,COLORREF)”: 无法将参数 3 从“TCHAR [512]”转换为“const char *”
vs2017项目属性——配置属性——常规——字符集:“使用Unicode字符集” 改为 “使用多字节字符集”。
其它方法:
char* ConvertLPWSTRToLPSTR(LPWSTR lpwszStrIn)
{
LPSTR pszOut = NULL;
if (lpwszStrIn != NULL)
{
int nInputStrLen = wcslen (lpwszStrIn);
// Double NULL Termination
int nOutputStrLen = WideCharToMultiByte (CP_ACP, 0, lpwszStrIn, nInputStrLen, NULL, 0, 0, 0) + 2;
pszOut = new char [nOutputStrLen];
if (pszOut)
{
memset (pszOut, 0x00, nOutputStrLen);
WideCharToMultiByte(CP_ACP, 0, lpwszStrIn, nInputStrLen, pszOut, nOutputStrLen, 0, 0);
}
}
return pszOut;
}
https://blog.csdn.net/cc198877/article/details/7520752?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
https://blog.csdn.net/cc198877/article/details/7520752?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task