Results 1 to 5 of 5

Thread: Execute after certain date??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154

    Execute after certain date??

    Is there a way to have a program run everytime windows starts after it is ran the first time?

    Then each time windows starts it will run and check the date..and if the date isn't what I tell it to be, then it wont execute anymore code...but when the date reaches my desired date, then it will excute the entire program??

    I think I would have to a first run variable though, that would check if it was the first time run..and if it was..then just exit....but I'm not exactly sure how I would do this either??

    Thanks

  2. #2
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    hi!

    To make a application start every time windows starts put the
    path to the application in the registry..
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

    And then when you run it just check the date
    if date < "2003-03-05" then
    end
    end if

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154
    How do I go about entering this value in the registry through dynamically created code??

    I dont want to have to open regedit to do this

    And to check if it is the first time the program is run do I just create boolean variable and assign it to true, then after the program runs once, set it to false?? cause the very first time it is run...I would want to enter it into the registry to run on startup...but after it has been registered in the registry, then I want to check what the date is before I continue with the execution of the program......maybe what I need to do is check and see if that value is in the registry?? but I'm not sure how to do that either?

    Thanks again

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    154
    One other thing...

    How would I make sure the date was in the same format as my if condition?? cause each PC could be in a different format?

  5. #5
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    hi! to read values from the registry you can use
    some api's

    http://www.allspi.net
    RegOpenKey
    RegCloseKey
    RegSetValueEx
    RegQueryStringValue

    and if the key isn't set it will be the first time you run the program.


    to make sure a date is formated as you want.. use
    format(Date, "mm/dd/yyyy")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width