社区
界面
帖子详情
mfc 的编辑框中怎么显示系统的当前时间啊
琴乐音
2007-01-24 09:54:19
如题!!!
CTime theTime;
theTime = CTime::GetCurrentTime();
取得时间, 但是怎么显示出来呢
...全文
869
14
打赏
收藏
mfc 的编辑框中怎么显示系统的当前时间啊
如题!!! CTime theTime; theTime = CTime::GetCurrentTime(); 取得时间, 但是怎么显示出来呢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xixuanfong
2007-02-01
打赏
举报
回复
楼上正解很多,不多罗嗦了哦,顶一下,呵呵
iProgramer
2007-02-01
打赏
举报
回复
来晚了
haoguozhong
2007-02-01
打赏
举报
回复
来晚了
yixiao386
2007-01-30
打赏
举报
回复
来晚了 没的说了 呵呵
lid0770
2007-01-30
打赏
举报
回复
CTime tm = CTime::GetCurrentTime();
CString sTime = tm.Format("%X");
cEdit.SetWindowText(sTime);
nadine
2007-01-30
打赏
举报
回复
dazedase说的对啊
miaoshengwu
2007-01-27
打赏
举报
回复
GetDlgItem(IDC_EDIT1)->SetWindowText("时间字符串");
jerry4711
2007-01-27
打赏
举报
回复
在OnTimer函数中写:
CTime tCurrentTime; //当前时间变量
int ih,im,is; //记录小时、分钟、秒的整型变量
tCurrentTime=CTime::GetCurrentTime(); //取得当前时间
ih=tCurrentTime.GetHour(); //取得当前时间小时数
im=tCurrentTime.GetMinute(); //取得当前时间分钟数
is=tCurrentTime.GetSecond(); //取得当前时间秒数
m_strCurr.Format("现在时间是%d点%d分%d秒",ih,im,is); //格式化字符串
UpdateData(FALSE);
dazedase
2007-01-26
打赏
举报
回复
最简单的方法:
CString m_strTime ;
CTime theTime;
theTime = CTime::GetCurrentTime();
m_strTime =theTime.Format("%Y/%m/%d %H:%M:%S");//Format注意大小写!!
再将m_strTime 显示到编辑框即可
东文-桑晨
2007-01-24
打赏
举报
回复
CTime theTime;
theTime = CTime::GetCurrentTime();
CString str;
str.Format("%d-%d-%d %d:%d:%d",
theTime.GetYear(), theTime.GetMonth(), theTime.GetDay(),
theTime.GetHour(), theTime.GetMinute(), theTime.GetSecond());
//年月日时分秒的顺序随你排列,就是说theTime.GetYear(), theTime.GetMonth(),
//theTime.GetDay(), theTime.GetHour(), theTime.GetMinute(), theTime.GetSecond());
//可以任意调换
SetDlgItemText(IDC_EDIT1,str);//IDC_EDIT1是你的编辑框空件的ID
pyrophile
2007-01-24
打赏
举报
回复
还要调用UpdateData(false);函数
niying
2007-01-24
打赏
举报
回复
if m_strTime = 编辑框
{
m_strTime.Format("%04d-%02d-%02d %02d:%02d:%02d", theTime.GetYear(),theTime.GetMonth(),...);
UpdateData(false);
}
王国凡
2007-01-24
打赏
举报
回复
再调用 SetDlgItemText 把 str 设置到编译框中.
王国凡
2007-01-24
打赏
举报
回复
CTime theTime;
theTime = CTime::GetCurrentTime();
CString str;
str.Format("%d-%d-%d %d:%d:%d",
theTime.GetYear(), theTime.GetMonth(), theTime.GetDay(),
theTime.GetHour(), theTime.GetMinute(), theTime.GetSecond());
MFC
动态
显示
当前
时间
你可以通过构造函数或者`CTime::GetCurrentTime()`静态成员函数来获取
当前
系统
时间
。例如: ```cpp CTime now = CTime::GetCurrentTime(); ``` 接着,为了实时更新UI上的
时间
,我们可以使用
MFC
的消息机制,尤其是`...
MFC
编辑框
、静态文本框相关的常用函数
MFC
编辑框
、静态文本框相关的常用函数
MFC
编辑框
和静态文本框是最常用的控件之一,在
MFC
编程
中
,它们的使用非常广泛。下面将详细介绍
MFC
编辑框
和静态文本框相关的常用函数。 1. GetDlgItemText(ID, str) 函数...
MFC
系统
时钟 状态栏
显示
时间
在OnTimer消息处理函数
中
,我们可以使用CTime类获取
当前
系统
时间
,并转换为适合用户阅读的格式,然后更新状态栏的文本。 关于"添加了背景图片"这部分,我们可以使用
MFC
的CDC类和CBitmap类来加载和
显示
位图。首先,...
MFC
使用CEF浏览器内核
这些库通常包含头文件、静态库和动态库,确保选择与你的
MFC
项目匹配的版本(如x86或x64,以及对应的操作
系统
版本)。 #### 2.2 配置项目设置 在
MFC
工程
中
,添加CEF库的引用路径,包括头文件目录和库目录。在链接器...
MFC
学生信息管理
系统
例如,使用CDialog派生类创建一个录入对话框,用户界面元素如
编辑框
(CEdit)和按钮(CButton)通过控件ID关联到类成员变量,以便在代码
中
读取和修改用户输入。当用户点击“保存”按钮时,事件处理函数(如...
界面
15,978
社区成员
115,866
社区内容
发帖
与我相关
我的任务
界面
VC/MFC 界面
复制链接
扫一扫
分享
社区描述
VC/MFC 界面
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章