注册 登录
编程论坛 VC.NET论坛

VS2005编译出错,请问这是为什么

pxy94 发布于 2008-04-10 17:00, 2317 次点击
char buf[10];
num2.GetWindowTextW(buf,10);
错误提示为:
错误    1 error C2664: 'int CWnd::GetWindowTextW(LPTSTR,int) const' : cannot convert parameter 1 from 'char [10]' to 'LPTSTR'    e:\my documents\visual studio 2005\projects\mfc\mfc\mfcdlg.cpp    163
2 回复
#2
flyue2008-04-20 17:55
char buf[10];
num2.GetWindowTextW((LPTSTR)buf,10);
试试
#3
pxy942008-04-22 16:15
[bo]以下是引用 [un]flyue[/un] 在 2008-4-20 17:55 的发言:[/bo]

char buf[10];
num2.GetWindowTextW((LPTSTR)buf,10);
试试

谢谢指点,用你的方法和把char改为TCHAR都可以,这是宽字符的问题

[[it] 本帖最后由 pxy94 于 2008-4-22 16:16 编辑 [/it]]
1