Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created a Synchronization program on Windows Forms.

Please can any one tell me the process for creating Windows Services which will start the program after 5 minutes of Interval.
Posted
Updated 11-Jun-15 19:42pm
v3
Comments
CodeReady 12-Jun-15 2:54am    
Have you gone through the articles of creation of windows service?
xibit89 12-Jun-15 3:52am    
Yes i have, but all articles refer to creation of Windows Services. I want to execute the program with in the time interval define in Windows Services code.

1. Create windows service project
2. Add Timer component to it.
3. Set the timer to 5 minutes
4. In TimerTick event stop the timer and run the program

If you have to restart the program if it is not started then
either restart windows service on program close
OR don't stop the timer and let windows service check if the program process exists before starting it.
 
Share this answer
 
Comments
xibit89 12-Jun-15 3:55am    
Can u please elaborate on 4th part "In TimerTick event stop the timer and run the program". how to run the program OnStart Method.
Sinisa Hajnal 12-Jun-15 6:08am    
Use Process.Start(your_exe_path) - look into Process class documentation for all possiblities
Windows Services have no UI, so you can't run your WinForm app as one, however you can:

Factor out the "sync" functionality to independent classes/functions without UI and use that in both the service and WinForm app.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900