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

What is stack size in win32 program?

1 Answers   HCL,

Types of DLL's

11 Answers   Invensys,

1)How to change the size of a button at run time ?

1 Answers  

List out the basic features of MFC.

4 Answers   Mphasis,

plzz tell me what we can do and dont in tally ERP & sap business one?

0 Answers  

1)dynamic creation of a Button ?

2 Answers   TCS,

Does the application have more than one object? If no, then what is the reason?

5 Answers  

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

2 Answers  

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

1 Answers   HCL,

What is the difference between OnInitialUpdate and OnUpdate?

5 Answers  

Why Array Index starts from Zero

30 Answers   HCL,

What types of threads are supported by MFC framework?

2 Answers