How to setup a timer?
Answers were Sorted based on User's Feedback
Answer / arvin
The SetTimer function creates a timer with the specified
time-out value.
Syntax
UINT_PTR SetTimer(
HWND hWnd,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc
);
Example:
SetTimer(1, 200, 0);
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / kamal
SetTimer(1, 10000, NULL);
Enter this function OnInitDialog()
| Is This Answer Correct ? | 0 Yes | 0 No |
We can set the timer using SetTimer method, this method
posts WM_TIMER message after every 'X' seconds configured,
The message will be placed in the message queue of the
application and application takes little time to take the
message and process so these are not accurate.
For accurate timers we have Multimedia timers,
To start a multimedia timer we can use
MMRESULT timeSetEvent(
UINT uDelay,
UINT uResolution,
LPTIMECALLBACK lpTimeProc,
DWORD_PTR dwUser,
UINT fuEvent
);
To kill a multimedia timer
MMRESULT timeKillEvent(
UINT uTimerID
);
Refers MSDN for more
| Is This Answer Correct ? | 0 Yes | 0 No |
what is functioning of DIalodDataXchange ..?
What is the use of CCmdTarget ?
What is CArchive class dowes?
How to update windows title bar dynamically?
19)how to set Back Ground Picture to a Dialog Box in MFC ?
What is the difference between Struts and JSF? Pls list some most suitable differences.
What is the use of OninitDialog ?
Tell me about different kinds of synchranization objects ?
1)How to change a text of a button as Dynamically?
How to setup a timer?
I have 2 threads. One thread prints odd numbers and the second thread prints even numbers. Now, I have to execute the threads alternatively so that i can output 1,2,3,4,5,6,..... write code for this?
what is the difference between compiling and building?