-
June 23rd, 2004, 03:02 PM
#1
Proper way to exit my service
What is the best way to exit my service? I want to stop my service on a few occasions if i encounter serious errors that will not allow me to proceed.
SHould I just set the state like:
Code:
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
and then return from ServiceMain()???
If i do this, then a messagebox pops up saying that the service started and then stopped.
-
June 23rd, 2004, 03:42 PM
#2
Check out DeleteService().
Kuphryn
-
June 23rd, 2004, 05:56 PM
#3
I don't want to delete the service, I just want to exit it.
-
June 23rd, 2004, 09:09 PM
#4
The following may be useful.
In case you encounter errors..
- You might want to close all the waiting threads
- Set the service status to service stop pending
- do any other cleanup
- then return
Hope this is what u r looking for..
If not state the exact problem with ur error instance & sample code..
Muthu
-
June 23rd, 2004, 09:33 PM
#5
Originally posted by muthuis
The following may be useful.
In case you encounter errors..
- You might want to close all the waiting threads
- Set the service status to service stop pending
- do any other cleanup
- then return
Hope this is what u r looking for..
If not state the exact problem with ur error instance & sample code..
add:
Set the ServiceStatus(...) to stopped before the return from ServiceMain(...), otherwise the SC manager should still believe a stop is pending and denote that with a timeout message.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|