Jump to content

Getting a uniGUI Service app running


wsv01

Recommended Posts

Being new at uniGUI I created one of my first system in desktop mode. Now I want to take that same application and get it running under a Windows service.

If I create a new service type application with nothing in it, it looks like the app is launched using this code

  if not Application.DelayInitialize or Application.Installing then
    Application.Initialize;
  Application.CreateForm(TUniServiceModule, UniServiceModule);
  Application.Run;

From an earlier post, I have set up my project with DEFINES like this

When running in VCL, this it how things are started and all works well

{$IFDEF UNIGUI_VCL}
  ReportMemoryLeaksOnShutdown:=True;  // Optional.
  Application.Initialize;
  TUniServerModule.Create(Application);
  Application.CreateForm(TUniServiceModule, UniServiceModule);
  Application.Run;
{$ENDIF}
 

When running as a service, I'm assuming this is how things are started.

{$IFDEF UNIGUI_SERVICE}
  if not Application.DelayInitialize or Application.Installing then
    Application.Initialize;
  Application.CreateForm(TMyServiceClass, MyServiceClass);  // Get from your service module.
  Application.Run;
{$ENDIF}

I'm assuming that I have to kick off the project through the ServiceModule? I'm not sure what to change this line to:

Application.CreateForm(TMyServiceClass, MyServiceClass);  // Get from your service module.

If I change to this, and I open the application, I just get a blank browser and it looks hung.

Application.CreateForm(TUniServiceModule, UniServiceModule);
 

BTW: I was able to get the application installed as a service and am able to start and stop the server without issues.

Link to comment
Share on other sites

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...