GetWindowText和SetWindowTextW以及SetWindowText
代码如下:
void CTestDlg::OnClickedBtnSum()
{
// TODO: Add your control notification handler code here
int num1,num2,num3;
char ch1[10],ch2[10],ch3[10];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
问题一:“->”处提示错误,信息如下,
1 IntelliSense: no instance of overloaded function "CWnd::GetWindowTextW" matches the argument list c:\users\administrator.pc-20110905onbv\desktop\demo\vc\dialog\mybole\mybole\testdlg.cpp 102 23 Mybole
“10”处提示错误,信息如下:
2 IntelliSense: too many arguments in function call c:\users\administrator.pc-20110905onbv\desktop\demo\vc\dialog\mybole\mybole\testdlg.cpp 102 43 Mybole
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10);
num1=atoi(ch1);
num2=atoi(ch2);
num3=atoi(ch3);
itoa(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
问题二:“ch3”处提示错误,信息如下:
5 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPCTSTR" c:\users\administrator.pc-20110905onbv\desktop\demo\vc\dialog\mybole\mybole\testdlg.cpp 108 39 Mybole
如果将“ch3”改为“_T(ch3)”,则会提示错误:
5 IntelliSense: identifier "Lch3" is undefined c:\users\administrator.pc-20110905onbv\desktop\demo\vc\dialog\mybole\mybole\testdlg.cpp 108 39 Mybole
这是怎么回事,应该怎样修改???
}
问题三:VS2010智能提示方法“SetWindowTextW”而不是“GetWindowText”,为什么???两者之间有什么样的差别呢???