Possible Duplicate:
Can I use a SetTimer() API in a console c++ app
I am looking to create a timer in c++ ,in a console win32 application .I google it and and find most results for SetTimer() ,but as example used for window control or others .
I need my timer to start a count ,right after the timer starts i call a function and after the timer ends ,i call an other function .I will be using threads .
I am a rookie in c++ ,so could this be done with SetTimer function ?
Thanks .
That’s not your way,
SetTimeris based on Windows messages system and will not work in console app just from box. You will need to create message pumping loop manually and do several other staff that is hardly met with console app structure and control flow.You could enjoy Waitable Timers objects instead. They are designed specially to be used with threads as sync objects.
Usage example:
See also nice article observing Windows timers: http://www.codeproject.com/Articles/1236/Timers-Tutorial