CString strText = _T(""); for (int num = 0; num < 7; num++) { CString str_num; str_num.Format(_T("%5d"), C彩票选号器MDlg::y[num]); strText += str_num; } //CString strText = str_nu; CStatic* pStaticText = (CStatic*)GetDlgItem(IDC_STATIC); // 获取静态文本控件指针 pStaticText->SendMessage(WM_SETTEXT, NULL, (LPARAM)(strText));这段代码有什么错误,并改正
时间: 2024-03-22 08:41:10 浏览: 65
HexStrToInt.rar_CString_HexStrToInt_cstring.h_str int
这段代码的错误在于使用了未定义的符号 `str_nu`,应该将注释掉的那一行去掉注释,或者将 `str_nu` 定义并初始化后再使用。
以下是纠正后的代码:
```cpp
CString strText = _T("");
for (int num = 0; num < 7; num++) {
CString str_num;
str_num.Format(_T("%5d"), C彩票选号器MDlg::y[num]);
strText += str_num;
}
CStatic* pStaticText = (CStatic*)GetDlgItem(IDC_STATIC); // 获取静态文本控件指针
pStaticText->SendMessage(WM_SETTEXT, NULL, (LPARAM)(strText));
```
这样就可以将 `strText` 的内容显示在静态文本控件上了。
阅读全文