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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spooler restart through StartService

Status
Not open for further replies.

ferrari123

Programmer
Feb 9, 2003
22
IN
Hi,
In one application , when i debug the application it is able to restart the spooler. But when i use cmd line ( basically just run the application) it just fails.
can anybody give me some idea about the sureshot way of restarting the spooler ?


 
Why does it fail? Did you call GetLastError to find out why it failed? It may be a matter of privileges (GetLastError retuns 5 (access denied) in this case). Are you debugging as an administrator and running it from the command line as a user, not being an administrator?

Marcel
 
It doesnt fail actually. StartService returns successfully.
After that if i check the status of service it is SERVICE_START_PENDING. But when the application is closed, spooler is still stopped.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top