|
-
Mar 5th, 2003, 02:35 AM
#1
Thread Starter
Addicted Member
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
-
Mar 5th, 2003, 03:05 AM
#2
Lively Member
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
-
Mar 5th, 2003, 03:11 AM
#3
Thread Starter
Addicted Member
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
-
Mar 5th, 2003, 03:16 AM
#4
Thread Starter
Addicted Member
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?
-
Mar 5th, 2003, 04:13 AM
#5
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|