You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Announcement
Collapse
No announcement yet.
SetTimer question: What is the maximum time allowed?
SetTimer question: What is the maximum time allowed?
From the API information: If uElapse is greater than USER_TIMER_MAXIMUM, the timeout is set to 1. However I cannot find any information about the value of USER_TIMER_MAXIMUM. Can you help me? Thanks in advance.
Erik,
if you have WinXP (not SP2 or later) then you could quickly figure it out by setting a very large time and seeing if it times out in 1ms. If it does, then reduce the time and try again until it doesn't
When it stops timing out in 1ms and starts timing out at the specified time then you've found USER_TIMER_MAXIMUM
How high do you need it to be?
For WinXP SP2 USER_TIMER_MAXIMUM is at least 10,000,000 and counting.. .
If you want really long delays, use GetLocalTime and SystemTimeToFileTime to get elapsed time in 100nS increments. (Just divide by 10,000,000 to get seconds)
According to the powerbasic API include files from Jose Roca site:
Code:
%USER_TIMER_MAXIMUM = &H7FFFFFFF???
His includes are based on a translation of the full window SDK files, so they include more than the ones that came with PB. And I have found them to be very accurate considering the amount of work involved. You might want to try them out. Note, before you will see the file attachments to download, you must sign in to his site.
"I haven't lost my mind... its backed up on tape... I think??" :D
If the function succeeds and the hWnd parameter is NULL, the return value is an integer identifying the new timer. An application can pass this value to the KillTimer function to destroy the timer.
If the function succeeds and the hWnd parameter is not NULL, then the return value is a nonzero integer. An application can pass the value of the nIDEvent parameter to the KillTimer function to destroy the timer.
If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.
Code:
FOR Z = 1 to %some_big_number
iRet = SetTimer (hWnd, %ID_TIMER, Z, %NULL)
IF ISTRUE iRet THEN
' timer created, so destroy it
KillTimer hWnd, %ID_TIMER
ELSE
MSGBOX "Can't create TIMER, I guess Z is too large!"
....
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment