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

1)To Remove WS_MINIMIZEBOX in a Frame ?

1 Answers  


How to access document object from view ?

1 Answers  


what message is sent to an application when the user presses the primary button?

0 Answers   University Exams,


What is the size of class

18 Answers   Aircom,


How can i implement the dynamic menus in MFC plz give the code

2 Answers  






Which CPrintInfo member variable must be set for multiple page printouts?

1 Answers  


What is the use of UpdateData funciton ?

7 Answers  


What is CArchive class dowes?

4 Answers  


How to update windows title bar dynamically?

7 Answers   HCL,


What four types of properties are supported by an ActiveX control?

1 Answers  


1)set the Title for The File DialogBox, in MFC?

1 Answers  


How can we create thread in MFC framework?

3 Answers  


Categories