How to setup a timer?

Answers were Sorted based on User's Feedback



How to setup a timer?..

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

How to setup a timer?..

Answer / kamal

SetTimer(1, 10000, NULL);

Enter this function OnInitDialog()

Is This Answer Correct ?    0 Yes 0 No

How to setup a timer?..

Answer / kishore kumar naik p

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

Post New Answer

More MFC Interview Questions

how to repaint when working with horizontal scroll bar

0 Answers  


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.

3 Answers   ABC, HCL, Infosys,


how does the UIThread and worker thread communicates and handle events

2 Answers   HCL,


if no message handler is available for a message then will deal with the message ? does window proving any default mechanism?

2 Answers   Patni,


what is the use of CWinApp class?

3 Answers   Mphasis,






Tell us something about MFC?

7 Answers   Microsoft,


How to handle dynamic menus in MFC?

3 Answers   HCL,


What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example

6 Answers  


What does mfc stand for?

0 Answers  


What is mfc class hierarchy?

0 Answers  


Given two processes, how can they share memory?

2 Answers   Microsoft,


How can update edit control data of an executing application from other application?

3 Answers   HP,


Categories