BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateData( TRUE );
m_TIME = SetTimer(1, 2000, 0);
UpdateData( FALSE );
return TRUE;
}
this is the code i have put. even wheni removed updatedata() it dint work
Printable View
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateData( TRUE );
m_TIME = SetTimer(1, 2000, 0);
UpdateData( FALSE );
return TRUE;
}
this is the code i have put. even wheni removed updatedata() it dint work
just try to Find in MSDN for WM_TIMER and there they have given sample program and other things in detail hope this will helps you.
If you're still using the code you posted, it can't possibly do what you want. I gave you the steps you need to follow. Give them a try.Quote:
Originally Posted by sudeep_br3
when the dialog loaded you settime-> SetTimer(1000,id);
void classname::OnTimer(UINT nIDEvent)
{
//CFormView::OnTimer(nIDEvent);
SYSTEMTIME now ;
GetSystemTime(&now) ;
COleDateTime dt_now(0, 0, 0, now.wHour, now.wMinute, now.wSecond) ;
COleDateTime diff(0, 0, 0, 5, 30, 0) ;
dt_now = dt_now + diff ;
int nHr ;
nHr = dt_now.GetHour() ;
CString strTimeofDay ;
/*strTimeofDay = "AM" ;
if(nHr > 12)
{
nHr -= 12 ;
strTimeofDay = "PM" ;
}*/
m_dtTime = dt_now ;
m_strTime.Format("%02d:%02d:%02d %s",
nHr,
dt_now.GetMinute(),
dt_now.GetSecond(),
strTimeofDay) ;
SetDlgItemText(Text_box id, m_strTime) ;
}
you will get the result - 00:00:00
u havent declared the two variables m_strTime and m_dtTime. what type r these two? i want to display timer value in edit control whose member variable is m_SPACE. which among the two is the member variable for edit control.
Quote:
Originally Posted by sudeep_br3
hai friend m_strtime->CString m_strtime;
m_dttime-> ColeDateTime m_dttime;
m_space=m_strtime;//m_space is your varibale for text box
updatedata(0);
if there any dought quote me
got the solution thank you