Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   MFC text box timer (http://www.go4expert.com/forums/mfc-text-box-timer-t17197/)

lightbulb 28Apr2009 19:48

MFC text box timer
im a having a hard time seting up clock for MFC text box... I would like my text box dispay timer from 10:00 up to 00:00 .. hope someone can help I really do need it thx alot in advance....:happy:

shabbir 28Apr2009 20:01

Re: MFC text box timer
What is the problem you are facing.

Have variables that updates based on the timer tick

lightbulb 28Apr2009 20:08

Re: MFC text box timer
This is what i would like to happen.. i got 1 textbox and 1 command box.. once 1 click my command box i would like for my textbox to start counting down from 10 minutes up to 0 minutes.. i tried using Sleep(1000) function but it doesnt work ..

shabbir 28Apr2009 21:50

Re: MFC text box timer
No thats not the way.

Have 2 variables for Minutes and Seconds and start counting them down each time that function is called.

Use the WM_TIMER event to be used for that function

lightbulb 29Apr2009 13:58

Re: MFC text box timer
well thanks. im just recently started learning MFC and sad thing about that is no is teaching me.. i'll just try to learn what WM_TIMER event does..... thx again... ^^

lightbulb 29Apr2009 14:42

Re: MFC text box timer
Hope this not too much.. can you write me s simple program using Settimer... i cant understand anything writen on the web about settimers and making a countdown timer... if its ok.. really do appreciate it ^^,,,,:)

shabbir 29Apr2009 15:03

Re: MFC text box timer

And then the following Function

void CTestDlg::OnTimer(UINT_PTR nIDEvent)

Also there should be a variable called m_seconds

And then in that function increase for every seconds tick

lightbulb 29Apr2009 15:58

Re: MFC text box timer
i dont know if this is right...
void CtimerDlg::OnBnClickedButton1()

UINT sec;
char u[90];
CString y;

is the value of sec will decrease from 60-0 every second upon clicking my command button? but how can i update the value of my text box every second?

shabbir 29Apr2009 16:50

Re: MFC text box timer
You need to have the variables in the class and not local to the function

lightbulb 29Apr2009 17:01

Re: MFC text box timer
  • thx a lot shabbir.. but i think i need to study MFC w/ pictures cause i can see what youre saying.. sry for being so noobish... thx alot for you help...

All times are GMT +5.5. The time now is 14:06.