GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
来源:互联网 发布:梦幻西游 mac问题 编辑:程序博客网 时间:2024/05/20 07:53
VC++6.0下常见的写法是:
int num1,num2,num3;
char ch1[10],ch2[10],ch3[10];
GetDlgItem(IDC_EDIT1)->GetWindowTextW(ch1,10);
GetDlgItem(IDC_EDIT2)->GetWindowTextW(ch2,10);
num1=atoi(ch1);
num2=atoi(ch2);
num3=num1+num2;
itoa(num3,ch3,10); //itoa(要转换的数, 目标buffer, 以什么进制转换) //int类型转换成字符型函数
GetDlgItem(IDC_EDIT3)->SetWindowTextW(ch3);
但是在VS2005里面,会报一下错误:
GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
SetWindowTextW' : cannot convert parameter 1 from 'char [10]' to 'LPCTSTR'
这是因为宽字符和窄字符的错误。
在VS2005下应该这样写:
//注意加粗字体的写法
int num1,num2,num3;
TCHAR ch1[10],ch2[10],ch3[10];
GetDlgItem(IDC_EDIT2)->GetWindowText(ch1,10);
GetDlgItem(IDC_EDIT3)->GetWindowText(ch2,10);
num1=_ttoi(ch1); num2=_ttoi(ch2);
num3=num1+num2;
_itot(num3,ch3,10);
GetDlgItem(IDC_EDIT4)->SetWindowText((LPTSTR)ch3);
- GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
- GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转换为“LPTSTR”
- error C2664: 'atof' : cannot convert parameter 1 from 'int' to 'const char *'
- cannot convert parameter 1 from 'CString' to 'const char *'
- cannot convert parameter 1 from 'const char *' to 'LPCWSTR
- cannot convert parameter 1 from 'std::string' to 'const char *'
- LoadCursorA' : cannot convert parameter 2 from 'const int' to 'const char *
- error C2664: “int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [10]”转"相关的问题
- error C2664: 'int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [7]' to 'LPCTS
- error C2664: “int CWnd::GetWindowTextW(LPTSTR,int) const”: 不能将参数 1 从“char [15]”转换为“LPTSTR”
- cannot convert parameter 2 from 'const char[15]' to 'LPWSTR';
- 'strcpy' : cannot convert parameter 2 from 'LPCTSTR' to 'const char *'
- cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR'
- 'strlen' : cannot convert parameter 1 from 'char [][80]' to 'const char *'
- cannot convert parameter 1 from 'const char [] ' to 'const wchar_t * '的解决方法
- tomcat 虚拟主机
- PKU ACM 1163
- 指针
- PKU ACM 1125
- TOMCAT虚拟主机配置
- GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
- 转] 软件工程
- 2010运营商的3G布局
- 动态规划法求解RMQ
- PKU ACM 2081
- B+树
- d
- 判断Symbian S60 TBuf 中是否含有中文字符的代码片段
- SocketAsyncEventArgs 单机测试成功突破 6W