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

What is the difference between regular dlls and extended dlls?

2 Answers  


what is the use of AFX_MANAGE_STATE ?

4 Answers   HCL,


what is the difference between SDI and MDI

15 Answers   CMC, HCL, Siemens,


How you create a button dynamically?

2 Answers  


How to update all the views whenver document got updated ?

1 Answers  


How to setup a timer?

3 Answers   IBM,


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

0 Answers  


What is the difference between the Encapsulation and Abstraction

25 Answers   HCL, Invensys, TCS, Wipro,


How can server communicate with more than one client

2 Answers   Invensys,


2.create for 10 batch: Employee_Number Employee_name Employee_Dateofjoining Employee_address Employee_salary 1.select the employee name who deriving more than 10 thousand salary and joined before august 08. use structure and pointers

0 Answers   TCS,


What is the difference between the ASSERT and VERIFY macros?

4 Answers  


Difference between Debug and Release versions?

4 Answers  


Categories