Announcement

Collapse
No announcement yet.

SetTimer question: What is the maximum time allowed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Erik Christensen
    replied
    Thanks a lot for your fine information and suggestions. It is very helpful.

    Best regards,

    Erik

    Leave a comment:


  • Michael Mattias
    replied
    SetTimer:
    Return Value

    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!" 
    
    ....
    ???

    Leave a comment:


  • William Burns
    replied
    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.

    Leave a comment:


  • Peter Lameijn
    replied
    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)

    Leave a comment:


  • Arthur Gomide
    replied
    A bug well known

    edit - since W95
    Last edited by Arthur Gomide; 29 Mar 2009, 07:27 PM.

    Leave a comment:


  • Cliff Nichols
    replied
    Unless I misread or misunderstood. The docs say the timer uses Tickcount which under "GetTickCount" remarks
    The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if Windows is run continuously for 49.7 days.
    Long time to test but if really wanting to know, have fun with it

    Leave a comment:


  • Paul Dixon
    replied
    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.. .

    Paul.

    Leave a comment:


  • David Roberts
    replied
    Haven't seen any official figures but have seen the following a few times at several places.

    #define USER_TIMER_MAXIMUM 0x7FFFFFFF

    Leave a comment:


  • 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.

    Best regards,

    Erik
Working...
X