CString str1,str, str2; GetDlgItemText(IDC_EDIT1, str1);
GetDlgItemText(IDC_EDIT2, str2); UINT value3 = _ttoi(str2);
if ( == value3)
{
return;
}
double value1 = _ttof(str1);
double value2 = _ttof(str2); double value = value1 / value2;
str.Format(_T("%.3f"), value);
GetDlgItem(IDC_STATIC_VALUE)->SetWindowText(str);
在mfc中使用宽字节的转换函数_ttoi()转为整型,_ttof()转为浮点型,使用cstring.format()把整型和浮点型转为字符串