Link to home
Start Free TrialLog in
Avatar of MarcG
MarcG

asked on

Could not start service (TService)

I have a problem with a service i made.
The service works after installing it and starting it manually, but anyway Windows reports an error that the service could not be started and that the service reported no error.
Here is the Code of the servie

procedure TASSvc.ServiceExecute(Sender: TService);
var IniF: TIniFile;
    Prog : String;
    sList: TStringList;
    i: Integer;
begin
  sList:= TStringList.create;
  try
    IniF:= TIniFile.create(SystemDir+'\'+IniName);
    try
      IniF.ReadSection(IniSection, sList);
      for i:= 0 to sList.Count - 1 do
      begin
        Prog:= iniF.ReadString(IniSection, IntToStr(i), 'Error');
        ShellExecute(0, 'open', PChar(Prog), '', '', SW_Restore);
      end;
    finally
      IniF.free;
    end;
  finally
    sList.free;
  end;
end;

The service shall start programms and they are started. So it was started and it finished its job. But windows keeps telling that the service could not be started.

I tried ReportStatus and Before and AfterInstall a LogMessage, but nothing works, it still says no error reporting.

What can I do to let Windows know that the service worked?
ASKER CERTIFIED SOLUTION
Avatar of AkinShin
AkinShin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MarcG
MarcG

ASKER

Thank you, it worked like this.

I set interactive to true, the service itself woked allright.