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(Send er: TService);
var IniF: TIniFile;
Prog : String;
sList: TStringList;
i: Integer;
begin
sList:= TStringList.create;
try
IniF:= TIniFile.create(SystemDir+ '\'+IniNam e);
try
IniF.ReadSection(IniSectio n, 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?
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(Send
var IniF: TIniFile;
Prog : String;
sList: TStringList;
i: Integer;
begin
sList:= TStringList.create;
try
IniF:= TIniFile.create(SystemDir+
try
IniF.ReadSection(IniSectio
for i:= 0 to sList.Count - 1 do
begin
Prog:= iniF.ReadString(IniSection
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I set interactive to true, the service itself woked allright.