懂Visual studio 2005/2008的来 小问题

来源:百度知道 编辑:UC知道 时间:2024/06/13 01:23:37
font.CreatePointFont(200,"宋体");不能编译
错误信息是
error C2664: “CFont::CreatePointFont”: 不能将参数 2 从“const char [5]”转换为“LPCTSTR”

这样就行了,font.CreatePointFont(200,_T("宋体")); 

vs 2005使用的是unicode

你可以在项目属性里面找到这个改为多字符集,以后就不会有这样的问题了,但是最好还是使用unicode风格,unicode风格的字符串一个字符占用两个字节

参数类型不对

font.CreatePointFont(200,L"宋体");//加个L

试试