C# – How to use CreateTimerQueueTimer to create a high resolution timer in C#


I've used a Windows multimedia dll to created a high resolution timer with


But the timeSetEvent() page recommends the use of:


How can I use CreateTimerQueueTimer() to execute a method every 10 milliseconds in C#?

Best Solution

Here is a link to a C# wrapper for CreateTimerQueueTimer:


(scroll down to the last post by Hobz for the sample class)

I just tried this out myself and it works fine. One thing you'll need to add, though, is a call to timeBeginPeriod(1) before starting the timer in order to set your system to high-resolution. timeSetEvent calls timeBeginPeriod internally, which is why some people mistakenly assume that it creates a higher-resolution timer.