CSettingDlg setbox;
COleDateTime t;
         cstring sctime="19:00:00";
// AfxMessageBox(sctime);
t.ParseDateTime(sctime,VAR_TIMEVALUEONLY);
// AfxMessageBox(t.Format(_T("%H,%M,%S")));
         setbox.m_sctime=t;m_sctime是一个datetimepicker控件,在dlg里的变量类型是Ctime,现在赋值无论如何也赋不进去,现在想对他赋值为19:00:00,但是他总是显示8:00:00,高手帮忙看一下哪里有误,改如何修改!!

解决方案 »

  1.   

    http://search.csdn.net/Expert/topic/1848/1848589.xml?temp=.4058039
      

  2.   

    如果可以的话,可以将程序发到:[email protected]
    我帮你看看!注明帖子的URL!
      

  3.   

    to  qiqiyeye(导航组打杂的@_@) datetimepicker在dlg里的变量类型是Ctime啊,ctime类没有settime方法啊to : vcleaner(我没做大哥已经很久了.......) 
    程序已经发出,帮忙看看吧,多谢!
      

  4.   

    你可能没有UpdateDate()
    或者把m_sctime改为控件型变量,试试
      

  5.   

    首先,鼠标右键点选控件的属性,切换到Styles中将Format属性改为Time,然后关联一个对象m_dt,再在OnInitDialog中输入下面的代码,祝你好运! CTime SetupTime02 = CTime::GetCurrentTime();
    int m_temp_yy,m_temp_mm,m_temp_dd,m_temp_h,m_temp_m,m_temp_s;
    m_temp_yy = SetupTime02.GetYear();
    m_temp_mm = SetupTime02.GetMonth();
    m_temp_dd = SetupTime02.GetDay();
    m_temp_h = SetupTime02.GetHour();
    m_temp_m = SetupTime02.GetMinute();
    m_temp_s = SetupTime02.GetSecond();
    CTime SetupTime01(m_temp_yy,m_temp_mm,m_temp_dd,19,00,0);
    m_dt.SetTime(&SetupTime01);
    m_dt.SetFormat(_T("HH:mm:ss"));