Home > Archive > Delphi > April 2005 > Delphi 6 TimeSetEvent Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Delphi 6 TimeSetEvent Problem
|
|
| WA Support 2005-03-31, 8:58 pm |
| Hello,
I am trying to help a friend understand a problem he is having with the TimeSetEvent function in Delphi 6.
Microsoft defines timeSetEven like so:
MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, 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 periodically.
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 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 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
| |
|
| WA Support wrote:
> Hello,
>
> I am trying to help a friend understand a problem he is having with the TimeSetEvent function in Delphi 6.
>
> Microsoft defines timeSetEven like so:
>
> MMRESULT timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, 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 periodically.
> 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 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 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.
| |
| Terry Russell 2005-04-06, 12:23 pm |
|
"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.
|
|
|
|
|