|
-
August 27th, 2004, 01:29 AM
#1
Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
So I'm looking for a function where you set previoulsy a determined day, with its hour, minute and second. What I want is that when reached this time in real life, it fires and event or a callback so I can execute a determined code.
What I don't want to do is a thread polling every second and comparing the actual hour with the one predetermined.
thanks guys.
-
August 27th, 2004, 01:56 AM
#2
Re: Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
There is no API function that satisfies your requirement. Please use timer to check periodically.
Quang
-
August 27th, 2004, 03:12 AM
#3
Re: Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
You could use the Task Scheduler API to fire a simple app at the day/hour/minute which uses an Event to signal your other process, or uses an IPC method etc. You'll be missing the seconds resolution though. But you could easily work around that by starting the task several minutes early, then setting up a timer in the task then firing the event when you've satisfied the seconds requirement ( set as the parameter being passed to the scheduled task)
http://msdn.microsoft.com/library/de..._reference.asp
-
August 27th, 2004, 04:22 AM
#4
Re: Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
 Originally Posted by petranca
What I don't want to do is a thread polling every second and comparing the actual hour with the one predetermined.
Then set a timer with an hour resolution, and in the handler check if the time is near and if it is, change to a minute resolution, then to a second resolution. Also check it in the application startup... I think it would be better then creating a dummy application to create a message launching by scheduler- that would be too much overkill.
"Programs must be written for people to read, and only incidentally for machines to execute."
-
August 27th, 2004, 04:34 AM
#5
Re: Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
thanks very much guys for ur help... i'll try to make an optimal polling with a thread and timer
-
August 27th, 2004, 05:13 AM
#6
Re: Is there any function that fires events when reaches an dd-mm-yyyy hh:mm:ss?
 Originally Posted by RoboTact
I think it would be better then creating a dummy application to create a message launching by scheduler- that would be too much overkill.
Actually that depends on your requirements, and in that I read "scheduled" as in must run. If you are not running as a service (hence you may not be running at the time you need to invoke the function), then using the task scheduler to perform some function at some day/time/hour is not overkill. You don't even require a dummy app, you could start your own app and in the init check for the existance of a mutex (already running) then post the event (start the timer) and exit.
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
|