private void InitializeFrameTimer() { TimerCallbackMethod callback = new TimerCallbackMethod(OnNextFrameTimed); CallbackHandle = GCHandle.Alloc(callback, GCHandleType.Normal); uint userCtx = 0; TimerID = timeSetEvent(TimerIntervalMilliseconds, 0, callback, ref userCtx, TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS); }
public static extern uint timeSetEvent(uint delay, uint resolution, TimerCallbackMethod callback, ref uint userCtx, uint fuEvent);