i try to develop a windows service. My win service must run if windows 7 stars up. How can i do?
Change the startup type of the service to Automatic
.
You should create an installer application for your service (if you haven't already) and you can set this option in there so when its installed it is pre-configured this way. See Walkthrough: Creating a Windows Service Application in the Component Designer
You set service startup to "Automatic" in service control manager. Not a programming question, by the way.
Actually make sure your installer sets the startup type on Automatic ;) Add dependencies as needed so that you start after dependent services.
If you want to set this programmatically (i.e. during the development phase) then this is set in the properties for the Installer (StartType), which you will also need.
You could configure the service through the command line using the "SC" utility provided by Windows; it comes with XP and later.
sc create MyServiceName binPath= <path to service exe file> start= auto DisplayName= MyServiceDisplayName
sc description MyServiceName "This is my service's description"
The spaces after arguments (like binPath= ) are important.