Interfaceless Application - How to keep it running
Posted on 2006-06-16
My past experience has always dealt with applications that have some sort of UI. Hence, the application would run as long as the main form was left open.
I am now building an application that requires no UI. It will run as a background application with a NotifyIcon to allow the user to end it, if necessary.
My question: What is the technique used to keep a UI -less application running? I currently have a module that has a Sub Main() which, at the moment, runs through some logic and then ends the application. The application is supposed to poll a dBase 5.0 table for new records and perform some task when the appropriate records are added to the table.
I thought of using a loop, but don't want to consume 100% of the CPU while this is running. I thought of using a timer object, but wouldn't that go away if the Main() sub ended?
How can I get a UI-less application to remain in execution, polling the table every so often without consuming the majority of the CPU cycles?