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 |
how to repaint when working with horizontal scroll bar
Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A. Explain how a pointer to function can be declared in C++? B. List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header ("Include") Files.
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 is the use of CWinApp class?
Tell us something about MFC?
How to handle dynamic menus in MFC?
What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example
What does mfc stand for?
What is mfc class hierarchy?
Given two processes, how can they share memory?
How can update edit control data of an executing application from other application?