Click here to Skip to main content
15,922,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Timer in 10 Msec Pin
Roger Stoltz20-Sep-07 20:35
Roger Stoltz20-Sep-07 20:35 
AnswerRe: Timer in 10 Msec Pin
Randor 20-Sep-07 20:46
professional Randor 20-Sep-07 20:46 
You should be using multimedia timers for increased accuracy. A window timer must pass through the window message loop which will cause increased non-uniform intervals.

As Cédric stated, you cannot guarantee that the operating system will *always* fire the timer callback within a specified timeframe. This is because of how the XP/Vista and prior operating system kernels interrupts have been implemented. However you can ask the operating system to increase the resolution from its default value of 64Hz (about 15ms) to the maximum possible value.

#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")  

TIMECAPS tc;

if (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(TIMECAPS)))
{
	TRACE1(_T("Setting system time resolution to: %d"),tc.wPeriodMin);
	timeBeginPeriod(tc.wPeriodMin);
}


http://msdn2.microsoft.com/en-us/library/ms713416.aspx[^]

Best Wishes,
Randor (David Delaune)
AnswerRe: Timer in 10 Msec Pin
ThatsAlok20-Sep-07 23:11
ThatsAlok20-Sep-07 23:11 
Question[Solved] cleanup, DestroyWindow or OnDestroy? [modified] Pin
Hamed Musavi20-Sep-07 17:37
Hamed Musavi20-Sep-07 17:37 
AnswerRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 18:12
DevMentor.org20-Sep-07 18:12 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 18:38
Hamed Musavi20-Sep-07 18:38 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 19:06
DevMentor.org20-Sep-07 19:06 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 20:16
Hamed Musavi20-Sep-07 20:16 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 20:32
DevMentor.org20-Sep-07 20:32 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 21:17
Hamed Musavi20-Sep-07 21:17 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org20-Sep-07 21:25
DevMentor.org20-Sep-07 21:25 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
Hamed Musavi20-Sep-07 22:33
Hamed Musavi20-Sep-07 22:33 
GeneralRe: cleanup, DestroyWindow or OnDestroy? Pin
DevMentor.org21-Sep-07 8:22
DevMentor.org21-Sep-07 8:22 
QuestionControlling other applications? Pin
Lord Kixdemp20-Sep-07 16:07
Lord Kixdemp20-Sep-07 16:07 
AnswerRe: Controlling other applications? Pin
Steve Echols20-Sep-07 16:51
Steve Echols20-Sep-07 16:51 
AnswerRe: Controlling other applications? Pin
nbugalia20-Sep-07 19:27
nbugalia20-Sep-07 19:27 
AnswerRe: Controlling other applications? Pin
ThatsAlok20-Sep-07 23:12
ThatsAlok20-Sep-07 23:12 
GeneralRe: Controlling other applications? Pin
Rajesh R Subramanian21-Sep-07 0:39
professionalRajesh R Subramanian21-Sep-07 0:39 
GeneralRe: Controlling other applications? Pin
ThatsAlok21-Sep-07 0:59
ThatsAlok21-Sep-07 0:59 
GeneralRe: Controlling other applications? Pin
Lord Kixdemp21-Sep-07 1:05
Lord Kixdemp21-Sep-07 1:05 
JokeOne More ?? Pin
ThatsAlok20-Sep-07 23:13
ThatsAlok20-Sep-07 23:13 
JokeRe: One More ?? Pin
Lord Kixdemp21-Sep-07 10:01
Lord Kixdemp21-Sep-07 10:01 
GeneralRe: One More ?? Pin
Mark Salsbery21-Sep-07 10:12
Mark Salsbery21-Sep-07 10:12 
GeneralRe: One More ?? Pin
Lord Kixdemp21-Sep-07 13:27
Lord Kixdemp21-Sep-07 13:27 
Questionkrunode Pin
youbo20-Sep-07 16:05
youbo20-Sep-07 16:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.