Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unattended Delphi 2007 Database Update Program

Status
Not open for further replies.

upchuckone

Technical User
May 22, 2006
1
US
Is there anyway a Delphi 2007 program can be structured to execute from a crontab file or windows scheduler in an unattended mode without any operator intervention?
 
It sounds like you're wanting to write a console program, but without any clues as to what you're trying to do, it's just a guess. In Delphi, go to File, New, Other and then choose Console. A console application doesn't come with any forms. You can create non-visual components in your code, but you'll be responsible for destroying them as well.

One of the problems with non-visual components is attaching methods to their events. You can get around this by simply creating a descendant component that overrides the appropriate method, eg. instead of trying to attach to OnExecute, dig into the component source and you'll find it probably has a protected method call DoExecute that checks the OnExecute property. Just override the DoExecute method in your descendant component with the code you want to run.

Console programs are designed to run once through their main begin..end block and then quit, which sounds like what you're after.
 
Can't you just add the .exe as a scheduled task in Windows?

The other option is to drop a timer on your form and have it check every so often if the time is >= the time you want the program to run. If if is, then execute the program. You could have the App sit permanently in the system tray.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top