TService and inheritance?

TService and inheritance?

Where and When is the TService descendant instantiated?

Is there some sort of compiler magic for services?

Getting weird .dfm property issues when trying to open the service unit that inherits the first one – without being able to see why.

Is it actually possible to create a descendant from TService (beyond the initial first level) and have that properly instantiated?

Unit1 – a normal service unit:

TServiceGen = class(TService)

procedure SomethingInCommon; virtual;

end;

Unit2 – a second service unit, but with the parent changed from TService to TServiceGen

TServiceGenChild = class(TServiceGen)

procedure SomethingInCommon; override;

end;

The Unit 2 dfm looks like

object ServiceGenChild: TServiceGenChild

OldCreateOrder = False

AllowPause = False

DisplayName = ‘PSD Server’

WaitHint = 10000

Height = 268

Width = 343

end

Unit 1 is ok, but loading Unit 2 into the IDE, shows the following error:

4 thoughts on “TService and inheritance?


  1. TService is instanciated in the dpr via “Application”.


    For a service, this is a different application reference than for a vcl application.


    When inheriting from a component with dfm, make sure that the it is “inherited ServiceGenChild: TServiceGenChild” in the dfm.

Leave a Reply