I mean that write code in windows service application to restart itself. It
does not include to restart service from second application or command line.
Hi,
Do you realize the contradiction in your statement?
You want to write a code that stops itself and then restart again :)
Having said that, you can use an external process to do it. if your win
service spawn a process then this process can stop the service, do what you
need and restart the service.
You use ServiceControlManager for that.

Signature
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
>I mean that write code in windows service application to restart itself. It
> does not include to restart service from second application or command
[quoted text clipped - 9 lines]
>>
>> Hans Kesting
MikeZ - 17 Jan 2008 17:29 GMT
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)
As you said, if the service cannot do the job by itself, an extra process is
the best choice.
Thanks.
> Hi,
>
[quoted text clipped - 20 lines]
> >>
> >> Hans Kesting
Willy Denoyette [MVP] - 17 Jan 2008 17:47 GMT
> For windows Application, it can restart itself by calling
> ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)
This does not restart an application, it restarts the system, you want to
restart the service, quite different isn't?
Restarting a Service is a feature that is OS version dependent, so what OS
are you running?
Willy.
MikeZ - 18 Jan 2008 17:18 GMT
Willy, I run Windows XP
> > For windows Application, it can restart itself by calling
> > ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)
[quoted text clipped - 5 lines]
>
> Willy.
christery@gmail.com - 20 Jan 2008 02:09 GMT
Try with nr 2 answer, put it in autorestart and just die... (the
service, not u) it will restart, but fixing problems that way is not
recommended..
//CY