Can you have two timers(Settimer/Ontimer) in one file
May 6, 2013 at 3:14pm UTC
Hey, I am working on this project where I need two differnt timers on a dialog. I have tried to add two timers but it is giving me problems. Are you allowed to have two different timers, I would think you can if you have two timer IDs. Below is what I have:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 void SettingsDlg::display()
void SettingsDlg::OnTimer(UNIT_PTR nIDEvent1)
void SettingsDlg::OnTimer(UNIT_PTR nIDEvent2)
When declaring two OnTimer() in the header I get the following error msg: OnTimer(UINT_PTR): member function already defined of declared.
Any help will be greatly appreciated!!!
Thanks In Advance
May 6, 2013 at 3:23pm UTC
Only define the function once. You have defined the same function twice with a different name for the parameter :p
May 6, 2013 at 4:02pm UTC
Thanks. So I am assuming that in the OnTimer() I need to check the value of nIDEvent variable and based on its value do something.
May 6, 2013 at 4:20pm UTC
Yes, if your code needs to react differently based on which timer went off, then you would check which one and execute the relevant code.
May 6, 2013 at 5:08pm UTC
Topic archived. No new replies allowed.