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.

UINT_PTR SetTimer(
HWND hWnd,
UINT uElapse,
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,
UINT fuEvent

To kill a multimedia timer
MMRESULT timeKillEvent(

Refers MSDN for more

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MFC Interview Questions

1)How to change a text of a button as Dynamically?

1 Answers   HCL,

How to find the mouse entering an image?..while entering need to display next image...

4 Answers  

what is the use of CWinApp class?

3 Answers   Mphasis,

What are the special requirements for dialog box resources used in a form view?

2 Answers  

How to handle dynamic menus in MFC?

3 Answers   HCL,

1)How to change a text of a button in runtime?

2 Answers  

what is the use of CCmdTarget?

4 Answers   Siemens,

how does conditionally close the Dialog Box ?

2 Answers   Infotech,

1)At run-time, you can change the icon by calling the LoadIcon() function?

2 Answers  

is it possible to display a window .without using windowclass

1 Answers   E Logic,

In VC++ How to transfer between one exe to another exe while running..

5 Answers   Wipro,

What is CSingleDocTemplate?

1 Answers