Jump to content

Recommended Posts

Posted

I have a project that is a stand alone exe.

 

I would like to keep it that way for debugging, but I would like to set an $DEFINE to build it as a service.

 

Is there something written up that would help me do this?

Posted

I think I figured it out.

 

Add to the Uses

  {$IFDEF RELEASE}
  SvcMgr,
  ServiceModule in 'Service\ServiceModule.pas' {SimpleLandlordService: TUniGUIService},
  {$ELSE}
  Forms,
  {$ENDIF }
 
Below the begin:
{$IFDEF RELEASE}
  if not Application.DelayInitialize or Application.Installing then
    Application.Initialize;
  Application.CreateForm(TSimpleLandlordService, SimpleLandlordService);
  Application.Run;
{$ELSE}  //WHAT EVER YOU CURRENTY HAVE BELOW
  Application.Initialize;
  Tsm.Create(Application);
  Application.Run;
{$ENDIF}

I still need to do more testing.

 

But it looks like my logging to CodeSite doesn't work when I run it as a service.

-UPDATE: it works to my logfile, but not to the live viewer.  But that is a codesite limitation

Posted

I make it similar to you. My only problem is when adding a new form or frame in debug mode Delphi deletes sometimes the "ServiceModule in 'Service\ServiceModule.pas'". Do you have same problem?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...