How to maintain the button in pressed state
-
HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...
-
HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...
-
HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...
Look up the
SetTimer
API - It should do the trick. Steve -
HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...
I think you want to display the current time in a EditBox Use SetTimer to Set a Timer preferable in OnInitDialog
SetTimer(2500,1000,NULL);
this is fire WM_TIMER every second Use ClassWizard to handle WM_TIMER message.....::OnTimer(UINT nIDEvent) { //Calculate the current time //Use SetWindowText instead of UpdateData for Performance reasons CDialog::OnTimer(nIdEvent); }
This is probably not the best way (cause of the delays) but will work Hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
-
Look up the
SetTimer
API - It should do the trick. Steve -
beat me to it :-D
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
Yeah, but you went into more detail - I was going to but I was too lazy. Steve
-
Yeah, but you went into more detail - I was going to but I was too lazy. Steve
-
I think you want to display the current time in a EditBox Use SetTimer to Set a Timer preferable in OnInitDialog
SetTimer(2500,1000,NULL);
this is fire WM_TIMER every second Use ClassWizard to handle WM_TIMER message.....::OnTimer(UINT nIDEvent) { //Calculate the current time //Use SetWindowText instead of UpdateData for Performance reasons CDialog::OnTimer(nIdEvent); }
This is probably not the best way (cause of the delays) but will work Hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
WonderFull!!!! it is working. Thanks a lot. Helping others satisfies you...