Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I am trying to help a friend understand a problem he is having with the Time SetEvent function in Delphi 6. Microsoft defines timeSetEven like so: MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimePr oc, DWORD dwUser, UINT fuEvent); Arguments: uDelay - Event delay, in milliseconds. Pretty much the same as uElapse in Se tTimer. uResolution - Resolution of the timer event, in milliseconds. lpTimeProc - Pointer to the callback function that we want to be called peri odically. dwUser - User data passed to the callback function. fuEvent - Timer event type. May be either TIME_ONESHOT, in which case the ca llback function is called only once, or TIME_PERIODIC for periodic calling. My friend says that he can not use a value greater than 999000 milliseconds for uDelay or the function dies. He has tried many values for uResolution, but all with the same results. To get around the 999000 milliseconds limit, he has put a sleep call in the callback function dwUser to put the process to sleep for the amount of time he needs timeSetEvent to actually run. Has anyone ever run into a limit on the number of milliseconds that can be f ed into timeSetEvent? If not, then what could possibly cause the limitation that we are experiencing? I can furnish the problematic code if necessary. Thank you, Murrah
Post Follow-up to this messageWA Support wrote: > Hello, > > I am trying to help a friend understand a problem he is having with the Ti meSetEvent function in Delphi 6. > > Microsoft defines timeSetEven like so: > > MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTime Proc, DWORD dwUser, UINT fuEvent); > > Arguments: > uDelay - Event delay, in milliseconds. Pretty much the same as uElapse in SetTimer. > uResolution - Resolution of the timer event, in milliseconds. > lpTimeProc - Pointer to the callback function that we want to be called pe riodically. > dwUser - User data passed to the callback function. > fuEvent - Timer event type. May be either TIME_ONESHOT, in which case the callback function is called only once, or TIME_PERIODIC for > periodic calling. > > My friend says that he can not use a value greater than 999000 millisecond s for uDelay or the function dies. He has tried many > values for uResolution, but all with the same results. > > To get around the 999000 milliseconds limit, he has put a sleep call in th e callback function dwUser to put the process to sleep for > the amount of time he needs timeSetEvent to actually run. > > Has anyone ever run into a limit on the number of milliseconds that can be fed into timeSetEvent? If not, then what could possibly > cause the limitation that we are experiencing? > > I can furnish the problematic code if necessary. > > Thank you, > > Murrah Strange, AT MSDN it states that its only supported in XP how ever, i find it in older Help files and states that its supported on all. oh well. Hmm so 16.5 mins is the min, why would some one want a multimedia timer any longer than that ? from the help uDelay " Event delay, in milliseconds. If this value is not in the range of the minimum and maximum event delays supported by the timer, the function returns an error." one needs to reference the "TimeGetDevCaps" to get the min and max range of the current driver for the sound card. etc.. you may want to think about using a Ttimer for long hauls.
Post Follow-up to this message"WA Support" <support@wildapache.net> wrote in message news:424c5a81.3291086392@news.wildapache.net... > Hello, > > I am trying to help a friend understand a problem he is having with the TimeSetEvent function in >Delphi 6. > To get around the 999000 milliseconds limit, he has put a sleep call in the callback function dwUser to put the process to sleep for > the amount of time he needs timeSetEvent to actually run. settimer, ttimer, sleep if it must be very accurate, sleep then wake up and poll or schedule timer for the last few milliseconds. > Has anyone ever run into a limit on the number of milliseconds that can be fed into timeSetEvent? If not, then what could possibly > cause the limitation that we are experiencing? Multimedia timers are very accurate, there are low limits on the number available. Using it for more such long delays is inappropriate.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.