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 |
Which Macro is a Super set of other two macro DECLARE_SERIAL,DECLARE_DYNAMIC and DECLARE_DYNCREATE. ?
List out the basic features of MFC.
What is the difference between regular dlls and extended dlls?
Explain about MDI and CMultiDocTemplate ?
what is the meaning of constant FILE EXCEEDS LENGTH LIMIT while loading from ps file to vsam in the jcl?
Hi All, i am new for VC++ SDK. i want to get the IP Address of all the External device connected with my local machine.please give the code Regards, Praveer
How to update windows title bar dynamically?
what do you mean by psychic window?
How we can findout Memoryleaks, In what way it can be avoided
how does the UIThread and worker thread communicates and handle events
if no message handler is available for a message then will deal with the message ? does window proving any default mechanism?
What are the differences between MFC Exception macros and C++ exception keywords?