刚开始学VC,用的VS2005。
有两个问题请教下各位大大。
1
BUTTON初始CAPTION是“收缩<<”
if (GetDlgItemText(IDC_BUTTON1,str),str="收缩<<")
{
SetDlgItemText(IDC_BUTTON1,_T"扩展>>");
}
else
{
SetDlgItemText(IDC_BUTTON1,L"收缩<<")
}为什么第一次点击的时候,BUTTON显示“扩展>>”
第二次点击的时候就不能显示“收缩<<”
2
int num1,num2,num3;
char ch1[10],ch2[10],ch3[10]; GetDlgItem(IDC_EDIT1)->GetWindowText((LPTSTR)ch1,9);
GetDlgItem(IDC_EDIT2)->GetWindowText((LPTSTR)ch2,9);
num1=atoi(ch1);
num2=atoi(ch2);
num3=num1+num2;
_itoa(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText((LPCTSTR)ch3);、 为什么输入num1 11 num2 11输出结果为2쳌쳌쳌쳌쳌쳌쳌쳌쳌11
有两个问题请教下各位大大。
1
BUTTON初始CAPTION是“收缩<<”
if (GetDlgItemText(IDC_BUTTON1,str),str="收缩<<")
{
SetDlgItemText(IDC_BUTTON1,_T"扩展>>");
}
else
{
SetDlgItemText(IDC_BUTTON1,L"收缩<<")
}为什么第一次点击的时候,BUTTON显示“扩展>>”
第二次点击的时候就不能显示“收缩<<”
2
int num1,num2,num3;
char ch1[10],ch2[10],ch3[10]; GetDlgItem(IDC_EDIT1)->GetWindowText((LPTSTR)ch1,9);
GetDlgItem(IDC_EDIT2)->GetWindowText((LPTSTR)ch2,9);
num1=atoi(ch1);
num2=atoi(ch2);
num3=num1+num2;
_itoa(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText((LPCTSTR)ch3);、 为什么输入num1 11 num2 11输出结果为2쳌쳌쳌쳌쳌쳌쳌쳌쳌11
解决方案 »
- MFC宏定义define,#define GIF int * \ GIF s , h; \ s ,h各是何类型?
- 1bit转化为32bitbmp 遇到问题
- 求助,字符串匹配问题
- 如何计算屏幕大小?
- 如何用odbc绑定DataGrid
- Add-ins安装问题:Visual Assist X的程序是怎么实现安装到VC中的,或者说VC中自定义(Customize)下相关信息保存在哪?
- 如何在MFC的按钮类中设置本按钮的鼠标形状?
- 本人用232转USB读取数据正确,但是485转USB读取数据出错,用调试助手都可以正常接收数据。
- 如何在vc2005中向vc6.0中那样删除一个类中的成员函数?
- 请问在Visual C++6里面怎么用SQLDMO 来备份数据库啊?
- 轻松实现 CTreeCtrl 的全选与反选
- 如何显示时间
if (str== "收缩 <<")
{
SetDlgItemText(IDC_BUTTON1,_T("扩展>>"));
}
else
{
SetDlgItemText(IDC_BUTTON1,_T(L"收缩 <<"))
}2、unicode的原因
int num1,num2,num3;
TCHAR ch1[10],ch2[10],ch3[10];GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,9);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,9);
num1=_ttoi(ch1);
num2=_ttoi(ch2);
num3=num1+num2;
_itot(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
还有,如果设置了unicode
"收缩 < <"要是 _T("收缩 < <")才对
不过第一个问题还是没解决,把CHAR改成TCHAR好像VS2005不认。