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

if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first

10 Answers   Siemens, Symphony,


WHAT IS DIFFERENT BETWEN RELEASE MODE & DEBUGGING MODE

4 Answers   Google, Microsoft, TCS,


Name the Synchronization objects?

2 Answers  


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

4 Answers  


1)why we cant create more than one instance of the class Derived from CWinApp

5 Answers   Alstom,






If i derive a new class from CObject what are the basic features my derived wil get ?

4 Answers   Microsoft,


How to update windows title bar dynamically?

7 Answers   HCL,


What is the difference between regular dlls and extended dlls?

2 Answers  


what is the use of Mutex and critical section

2 Answers  


What is the difference between hinsrtance and hprevinstance in WinMain function?

3 Answers  


What function is called by a document class to notify views that the document has been changed?

2 Answers  


What types of threads are supported by MFC framework?

2 Answers  


Categories