It is declared in the Winuser.h (include windows.h) and you must provide your own callback function which will be called by windows when its time. The prototype of the callback is:
VOID CALLBACK TimerProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_TIMER message
UINT_PTR idEvent, // timer identifier
DWORD dwTime // current system time
);
Although the prototype implies you need to supply a handle to a window, this is not necessary and you can set it to NULL. The difference of timing this way is that your program will not be halted the way a function like Sleep() does, and your program can continue doing its tasks until it is interrupted by the timed out callback, after which your program can continue its tasks. (There is also the Beep() function, which does simply what its names says: it gives a beep. And I've use it to experiment with SetTimer(); it works nice and easy =)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.