Click here to Skip to main content
Click here to Skip to main content

Simple Parental Control Service in C#

, 31 Mar 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Windows service in C# which allows to control computer's ON/OFF time: automatically turns computer OFF every day at the desired time

Introduction

This project helps to create your own parental control service in C#. The current version will shutdown Windows if an unauthorized user (your kid) tries to boot the family PC during blockout period, say from 11 pm to 7 am.

Background

My friend Alexander asked me if I can help him to control his kid's access to the family PC. I did some research on the Internet and found that there are many of those applications available but:

  1. You have to buy them
  2. They are too complicated for use and have too many options which I will never use

So, I decided to write my own application to help him. The idea was just to write a Windows service which will monitor the system clock and shut down the system if blockout time occurs. But an easy way for a kid to fix this is to change the system clock. This operation takes a little effort and could be done by any computer kid. So, our service has to fix the system clock whenever it's changed. To do that, we can use some Internet resources, say well known time saver tick.usno.navy.mil.

Using the Code

The project contains three main parts:

  1. Service Control Part ParentControl.cs, which checks the current system clock against the blockout period.
  2. Internet Time Synchronization Client NTPClient.cs (written by Valer BOCAN vbocan@dataman.ro).
  3. ExitWindows.cs which is just a C# wrapper for ExitWindowsEx API call (original C++ code sample could be found here).

If the service cannot obtain time from the time server, it will shut down the computer as well. By default, the blockout period starts at 11 pm and ends at 7 am. You can specify different numbers as two parameters at the service start time. In the DEBUG version (only!) this service will ask if you want to shut down your PC or not. To make it possible, you have to check the "Allow service to interact with desktop" box when starting the service.

To install the service, you use InstallUtil.exe from the .NET Framework or call it from the command line with argument -i:

ParentalControl -i 

To make the service self installable, I used a technique described in my other article (Windows Service which Kills Unwanted Windows).

Points of Interest

This project could be easily developed for different parental control services depending on what you need.

History

  • First version uploaded March 31st, 2008

License

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

Share

About the Author

Victuar
Software Developer (Senior) Intel Corp.
United States United States
No Biography provided

Comments and Discussions

 
Questionhow to uninstall it? PinmemberMember 1045492116-Mar-14 2:54 
Generalparental control web filter Pinmemberrudychip16-Aug-09 4:03 
GeneralRe: parental control web filter PinmemberPascal Ganaye17-Jun-10 11:16 
QuestionControl Computer Access Pinmemberansar_ansar12-Dec-08 3:22 
GeneralZip file link Pinmemberfwsouthern6-Apr-08 18:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 1 Apr 2008
Article Copyright 2008 by Victuar
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid