Window Service : The core function of a windows service is to run an application in the background. There are few things that make them different from a Windows application. A Windows service starts much before any user logs in to the system (if it has been setup to start at boot up process). A Windows service can also be setup in such a way that it requires a user to start it manually – the ultimate customization!
Windows services have their own processes, and hence run very efficiently. Normally a Windows service will not have a user interface for the simple reason that it can be run even if no one is logged into the system, but this is not a rule -- you can still have a Windows service with a user interface.
you can view a list of services currently running on your computer by opening Control Panel -> Administrative Tools -> Services, as shown below:
Developing Windows Services changes completely in .NET. VB.NET is as good a choice as any other .NET language for developing a Windows Service. As with many areas of advanced functionality, the reason you can use VB.NET for this purpose is because base classes in the .NET Framework take care of the system-level interfacing. You need two base classes to create a Windows Service in VB.NET: System.ServiceProcess.ServiceBase and System.Configuration.Install.Installer.
System.ServiceProcess.ServiceBase provides the base class for the service itself. The class that inherits from this class contains the logic that runs in the service. System.Configuration.Install.Installer provides the interface necessary to get the service installed under Windows 2000 and NT. It isn't typically necessary to put any logic in your installer class.
Create the Beep Service example
Create a new project in Visual Studio with the type Windows Service. Name the project BeepService, then go to the design surface for the Service1 component. Open the Toolbox and click on the Components tab. Drag a Timer control from the Toolbox onto the Service1 component. It appears on the design surface with the name Timer1.
In the Properties window for Timer1, change the Interval property to a value of 3000. (i.e; 3,000 milliseconds, which causes the timer to fire every three seconds.) Then go back to the code for Service1.vb. Enter this code in the OnStart event:
Install the Beep Service
You must start the .net utility InstallUtil.exe from a command line to install the window service. InstallUtil.exe is located in "c:\windows\Microsoft.NET\Framework\v2.0.50727". Start up a DOS-style command window or Visual Studio.NET command Window and change the current directory to
Now goto Control Panel -> Administrative Tools -> Services as shown above, Note the presence of the BeepService program you installed earlier; if BeepService doesn't appear, the installation wasn't successful.