Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Services

Status
Not open for further replies.

minckle

Programmer
Mar 17, 2004
142
GB
Hi, I've wrote a Windows Service using Delphi 5 which communicates with a GSM Modem connected to a com port on a computer.

The service works fine but every now for some reason the service crashes and goes into a "Stopping" Status. No failures or errors are reported in the Event Logs.

Can any shed a light on what is likley to be happening or What "stopping" actually means??


Thanks
 
this means that your service thread is no longer active, but it hasn't been reported to the windows SCM.

try to catch the exception (if you aren't already doing this)

here is some psuedo code of how your loop should be :
Code:
...
procedure TServiceThread.Execute
begin
 // service thread loop
 while not Terminated do
 try
  ServiceThread.ProcessRequests(False); // make sure we can process scm requests (service stop/pause,...)
  Sleep(20); //!!! prevent 100% cpu time 
  try
   // init objects
  finally
   // free objects
  end
 except
  on E : Exception do
   begin
    Logmessage('fatal exception : '+E.Message);
   end;
 end;
end;
...

--------------------------------------
What You See Is What You Get
 
I keep getting the following error when i start my service

"The MyService service on local Computer started and then Stopped. Some Services stop automatically if they have no work to do, for example, the Performance Logs and Alerts Service"

Does anyone know what this means????

Can anyone direct me to a good website about creating Windows Services??
 
can you show some code?

I can give you some advice then

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top