I like the ability to specify whether my server will run as a desktop application or windows service. When running as a desktop app, I use the mainform to display a log of application events in a TMemo component.
However, when I run the server as a windows service, the events need to be logged in the event viewer. How do I determine the current run mode to do something like this:
if <<running_as_service>> then
Write(EVENTLOG_INFORMATION_TYPE, 2, ‘error connecting to the DB…’)
ServerForm.memo1.text := ‘error connecting to the DB…’