Converting a console application to a Windows service
Writing and debugging a Windows service can be difficult and slow. In the Creating a Windows service recipe in Chapter 1, Delphi Basics you learned how to do it from scratch, but in some cases you already have a console or VCL application that already does its job, but it would be much better if it could be recreated as a Windows service.
Getting ready
In this recipe, we'll take the WebBroker application created in the previous recipe as a console application, and convert it to a full flagged Windows service. The same approach can be used for any type of service-like application that is not currently built as a service.
As a bonus, we'll learn that, if correctly architected, a project can be compiled as a console or VCL application and, without many changes, also as a Windows service. WebBroker is particular well architected to do so, so our application will benefit from it.
How to do it…
Perform the following steps:
Create a new Service Application...