Fouzia -- There is a batch file in the apache folder which installs apache as a service. See this from the readme file:
\xampplite\apache\apache_installservice.bat = Install Apache 2 as service
\xampplite\apache\apache_uninstallservice.bat = Uninstall Apache 2 as service
_installservice.bat = Install MySQL as service
\xampplite\mysql\mysql_uninstallservice.bat = Uninstall MySQL as service
Restart your system after any install or uninstall. You can then follow the advice given to set the recovery options on the apache service (Select apache, right click, Properties, Recovery tab, set First and Second failure to restart service).
I find that it is also useful to run a batch file to send an email alert if the service fails. To do this you set the failure action to "Run a program" and enter the name of a batch file. Take a look at Blat (http://www.blat.net/
) if you want to do this.