A probe into Windows services

Source: Internet
Author: User
Tags system log
Windows services are Windows applications that work independently of logged-in users and typically start at the time the computer starts, and are often performed continuously until the computer shuts down. This approach, such as Exchange Server,iis and antivirus software, can be used independently of a user and can be run at any user logon, and can serve all processes, thus being in the form of a service.
Because Windows services have so many features, you can consider using Windows services to solve problems when you need some special features. For example, here's what we're going to do. For our program designers, the computer is the longest working partner, each day will be on its screen for more than eight hours, not including the time after work at home to play games, so protecting the eyes is the most important. The cause of the problem is that I went to ophthalmology Saturday to review the laser surgery, the doctor repeatedly stressed to me the ability to adjust the eyes, that is, as long as you can guarantee that you every one hours or so close your eyes closed or overlooking, leaving the computer screen, so has been cured myopia will not rebound. Although I am more self-discipline, but in front of the computer screen is no longer so, often a few hours also do not look up once, for the health of the eyes, I decided to put this arduous task to the computer to complete, let it in an hour or so automatically remind me to rest for five minutes. In this way, it is no longer necessary to worry about this matter.
Although the function is simple, but to write a program in the Startup group to automatically run every day is not a good way, just happened to have not done Windows services, as simply to try, with a look. NET provides us with how advanced function bar, then decided, use C # to do a remind me to protect the eyes of Windows service, name is called Careeye Bar.
Run Visual Studio.NET 2003 to establish a C # Windows service project, The CareEye.cs Design view prompts you to drag the controls and components you need onto this, and if you want to do a system log, you can, of course, drag the EventLog component over, but the program doesn't seem to need these things, or forget it. Do you want to use timer controls? Thought for a moment, although this control is easy to use, but too often, in the spirit of learning new knowledge, the most appropriate is the thread, and in the future to do other Windows services when the thread is certainly necessary, so still with the thread, so that I only in the process to complete the time monitoring, Put the start and stop of the thread to the start and stop of the service, ah, very convenient.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.