编程论坛's Archiver

pxy94 发表于 2008-4-10 17:00

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

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

flyue 发表于 2008-4-20 17:55

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

pxy94 发表于 2008-4-22 16:15

[quote][bo]以下是引用 [un]flyue[/un] 在 2008-4-20 17:55 的发言:[/bo]

char buf[10];
num2.GetWindowTextW((LPTSTR)buf,10);
试试 [/quote]
谢谢指点,用你的方法和把char改为TCHAR都可以,这是宽字符的问题

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

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.