我想在VC中使用一个函数! MFC书上说是CTime类 我想使用这个类里的GetTime函数
我的写发是(别笑我,我刚开始学)void CTest4Dlg::OnButton1() 
{
// TODO: Add your control notification handler code here
UpdateData(true);
m_text3=CTime::GetTime ();
UpdateData(false);
}请问正确写发是什么? 是什么道理呢? 请告诉我!谢谢

解决方案 »

  1.   

    你的GetTime()没有对象。
    请看
    CTime::GetTime 
    time_t GetTime( ) const;ResReturns a time_t value for the given CTime object.Example// example for CTime::GetTime
    CTime t( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999
    time_t osBinaryTime = t.GetTime(); // time_t defined in <time.h>
    printf( "time_t = %ld\n", osBinaryTime );
      

  2.   

    CTime t = CTime::GetCurrentTime();
    m_text3.Format("%d年%d月%d日", t.GetYear(), t.GetMonth(), t.GetDay());
      

  3.   

    这样写: CTime curtime;
    CString stime; curtime=curtime.GetCurrentTime();
    stime=curtime.Format("%Y%m%d");这样,你得到的结果在CString stime中,格式为: 20030711
      

  4.   

    void CTest4Dlg::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    UpdateData(true);
    CTime t = CTime::GetCurrentTime();
    m_text3.Format("%d年%d月%d日", t.GetYear(), t.GetMonth(), t.GetDay());UpdateData(false);
    }这些有个错误!
      

  5.   

    在使用MFC的时候! 有没有好的工具?