您当前的位置: 首页 >  ar

txwtech

暂无认证

  • 2浏览

    0关注

    813博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

c2664无法将参数 3 从“TCHAR [512]”转换为“const char *”

txwtech 发布时间:2020-02-29 17:20:27 ,浏览量:2

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

关注
打赏
1665060526
查看更多评论
立即登录/注册

微信扫码登录

0.0414s