c++ - 格式':不是'CStatic'计时器的成员
问题描述
void CTimersDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CTime curTime = CTime::GetCurrentTime();
m_sTime.Format("%d:%d:%d",curTime.GetHour(),curTime.GetMinute(),curTime.GetSecond());
// Update the dialog
UpdateData(FALSE);
CDialogEx::OnTimer(nIDEvent);
}
解决方案
使用 MFC,您可以创建两种与 a 关联的变量STATIC
:control
类型为CStatic
(如您所拥有)和value
类型为CString
.
您标记visual-studio-code
了 - 那是您正在使用的吗?如果您正在使用Visual Studio
,我建议使用向导:右键单击STATIC
对话框中的控件(在资源编辑器中)并选择Add Variable...
. 在Category
下拉框中选择Value
. 您将能够调用.Format()
该变量。
您可以为同一个控件创建两种变量,不确定是否需要。
推荐阅读
- c++ - 当我在谷歌测试程序中定义一个 const 字符串时,为什么会发生分段错误?
- r - 我想根据比赛结果打分,但出现错误
- python - FileNotFoundError: [WinError 2] 使用 librosa 加载文件时系统找不到指定的文件
- reactjs - electron-webpack-react 错误“模块解析失败:意外字符 '@'”
- android - 在生命周期开始之前,片段中的上下文为空?
- python - 将矩阵从 [?, 100] 重塑为 [batch_size, ?, 100]
- java - 单击按钮后对 Firebase Recyclerview 进行排序
- angular - 从 Rxjs WebSocket 主题调用返回 Observable 数组
- python - 如何使用三重算法使用 56 个字符的键对字符串进行编码?
- confluent-platform - KSQL 'SELECT *' 查询需要 10 秒才能开始返回任何结果