CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Timer more precise than SetTimer

    I'm curious if there's a timer function more precise than calling SetTimer and then processing WM_TIMER events? I call it at a frequency of 100ms and sometimes those WM_TIMER messages get delayed on older systems.

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Timer more precise than SetTimer

    Multimedia timers are more precise.

  3. #3
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Timer more precise than SetTimer

    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Timer more precise than SetTimer

    That's how regular timers work, the interval you set is a lower limit, but not a precise interval. If the system is busy, a WM_TIMER can be delayed for several seconds, nomatter how low you've set the interval, and even regardless of the priority the thread/process are running on.

    Multimediatimers are more precise both in allowing finer granularity as well as guaranteeing the timer procedure will get called closer to the set intervals.
    But you are restricted in what you can safely do from a multimedia timer procedure.

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Timer more precise than SetTimer

    Thank you everyone.

    Quote Originally Posted by OReubens View Post
    But you are restricted in what you can safely do from a multimedia timer procedure.
    What do you mean by that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured