Announcement

Collapse
No announcement yet.

scheduled actions -- How to??

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

  • scheduled actions -- How to??

    I'm developing a program that requires a scheduled action -- say every 15 minutes, half-hour, etc. The program will usually be minimized or, at least, not the focus when this happens.

    Can someone get me started on how to approach this in PB/DLL?

    Thanks,
    Dale

    ------------------

  • #2
    What I would recommend is making a modeless dialog and then upon
    loading create a timer at 1 second intervals.

    When you get the callback for the timer compare that time to
    the time that is stored in a file.

    If the two compare then run the event, if not then ignore it.

    This is what I use currently.

    INTERVAL.DAT
    12:00:00 AM
    12:00:00 PM
    3:05:00 AM
    12:08:33 PM

    Of course that is 12 hour format and if you use TIME$ it is 24
    hour format. I currently use something like this to extract ODBC
    information at given times.

    Hope that helps.


    ------------------
    -Greg
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

    Comment


    • #3
      Dale,

      You could also use GetTickCount which returns a long integer of
      milliseconds, then you don't have to worry about time format, but
      now you can worry about going past the upper bounds of the
      long integer. Either way will do the trick.


      ------------------
      "There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs." - John Rogers

      Comment


      • #4
        What I would recommend is making a modeless dialog and then upon
        loading create a timer at 1 second intervals.
        Um, why not just have the timer set to every fifteen or thirty minutes?

        UINT SetTimer(

        HWND hwnd, // handle of window for timer messages
        UINT idTimer, // timer identifier
        UINT uTimeout, // time-out value
        TIMERPROC tmprc // address of timer procedure
        );
        15 minutes = 15*60*1000 milliseconds, well within the range of UINT (Long/Dword).

        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Michael,

          That works fine if you have only one different time interval's.

          What if you want an event to trigger at every 2 minutes and
          then one every 3 hours and another one at 7:04:00 PM.

          Keeping track of each timer could be hard. I recommend just
          one timer.

          ------------------
          -Greg
          -Greg
          [email protected]
          MCP,MCSA,MCSE,MCSD

          Comment


          • #6
            Greg, that is not really a difficult situation to manage at all (there was a very low limit to the number of timers in Win16, but not in Win32)... just track the ID number you allocate to each timer in SetTimer(), and query the timer ID in the %WM_TIMER handler.

            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              In know that you can use the AT commend at the command prompt
              in Windows NT to schedule programs to run whenever you want.

              I seem to remember that there is something like that on
              Windows 98 and 95.

              I think that this might be a better solution. Let Windows do it!

              ATB

              Charles Kincaid

              ------------------
              ATB

              Charles Kincaid

              Comment

              Working...
              X