Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I usually create my application in such a way that it can be started as a service or as a GUI, via a commandline switch <code>/GUI</code>.</p> <p>When the application runs with a GUI, I instantiate and start the service class "manually". </p> <p>Advantages:</p> <ul> <li><p>It'll run the same code, making it very easy to debug the service. You can just put breakpoints and step through your code without having to "attach" to a running application. </p></li> <li><p>Because of the GUI, you can see what your service would be doing, and interact with it, via listviews and buttons, even on remote servers where you don't have a debugger. Having to interact with your service via logs and configurations is crappy and slow.</p></li> </ul> <p>Example dpr, from a project that works like this:</p> <pre><code>program xxxx; uses SysUtils, SvcMgr, .......; {$R *.res} begin GlobalAppId := 1; MapMatcherController := TMapMatcherController.Create(nil); try if FindCmdLineSwitch('GUI',['/','-'],True) then begin Forms.Application.Initialize; Forms.Application.MainFormOnTaskbar := True; Forms.Application.CreateForm(TfrmMain, frmMain); Forms.Application.Run; end else begin SvcMgr.Application.Initialize; SvcMgr.Application.CreateForm(TsrvMapMatcher2, srvMapMatcher2); SvcMgr.Application.Run; end; finally MapMatcherController.Free; end; end. </code></pre> <p>Oh, another thing to keep in mind is that services usually run as a "system" user, which means you'll have different privileges and settings (for example drive letter mappings).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload