mfc 的编辑框中怎么显示系统的当前时间啊

琴乐音 2007-01-24 09:54:19
如题!!!
CTime theTime;
theTime = CTime::GetCurrentTime();
取得时间, 但是怎么显示出来呢
...全文
943 14 打赏 收藏 举报
写回复
用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());
内容概要:本文系统研究了永磁同步电机(PMSM)的速度控制问题,重点探讨了矢量控制(FOC)技术的原理与实现方法,并基于Simulink搭建了完整的仿真模型进行验证。文章深入剖析了矢量控制的核心环节,包括Clarke变换与Park变换在内的坐标变换原理、磁场定向控制策略、双闭环(电流环与速度环)PI控制器的设计,以及空间矢量脉宽调制(SVPWM)技术的应用。通过仿真实验,验证了该控制策略在调节PMSM转速和转矩时具备良好的动态响应性能和稳态精度,为高性能电机驱动系统的研发提供了详实的理论依据和技术参考。; 适合人群:具备电机学、电力电子技术和自动控制理论基础的电气工程、自动化、机电一体化等相关专业的本科生、研究生、科研人员及从事电机驱动开发的工程技术人员。; 使用场景及目标:①深入学习和掌握永磁同步电机矢量控制的理论基础与关键技术;②利用Simulink进行电机控制系统的建模、仿真与算法验证,服务于课程设计、毕业设计或科研项目;③为工业领域中高性能伺服驱动器、新能源汽车电驱系统等产品的开发提供技术方案与仿真支持。; 阅读建议:建议读者结合提供的Simulink仿真模型,动手实践并调整控制器参数(如PI参数),通过对比不同参数下的系统响应曲线,深刻理解各控制环节的作用和系统动态性能的优化方法。

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧