Home arrow Delphi-Kylix arrow Page 3 - Finishing the Client for an Internet Access Control Application

Finishing the Client for an Internet Access Control Application

Last week we began our discussion of the client side of an Internet access control program. This week we'll continue to cover the important parts of the code. We'll start with the reading thread, then go to the ini file. Keep reading to be enlightened.

Author Info:
By: David Web
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
October 06, 2008
  1. · Finishing the Client for an Internet Access Control Application
  2. · Check the ini file
  3. · Code Explained
  4. · The Timer Window

print this article

Finishing the Client for an Internet Access Control Application - Code Explained
(Page 3 of 4 )

The code is substantial, so we are only going to look at a few important functions and procedures. Most of the other procedures are easy to understand and also commented for easy reading.

The first part of the code declares four functions. Here they are in order:

TimedShutDown(Computer: string; Msg: string; Time: Word; Force: Boolean; Reboot: Boolean): Boolean; :

This first function is responsible for implementing the shutdown command. It will be called when a staff member clicks on the shutdown button. I've tested this function on WinXP and Win2000; I didn't get any problems on either system. 

The first argument that it takes is the name of the workstation that you want to shut down. Then it takes a text message that you want displayed on the shut down dialog box and since it is a timed shutdown, you need to specify the time in seconds next (in this case I've put in 30, but you may want to reduce or increase this to suit). The last two arguments are of type Boolean; both are set to true. The advantage of this function is that it centralizes control over the workstations.

FuncAvail(dllName, funcName: string; var p: pointer): boolean;:

This function is responsible for blocking keyboard and mouse access when the workstation is first switched on. How long it will block access is determined by a separate timer.

ParseString(s : string; var Token1,Token2,Token3: string) :


You should be familiar with this function by now. It is responsible for breaking down server communication into three parts separating the command, action and any other message.


The GetComputerName function simply retrieves the name of the workstation. This is very important because the client application will try to connect to the server using this name; if it is not able to retrieve the name and then tries to connect to the server, it will be rejected.

The Message Synchronization Functions

These functions are responsible for ensuring smooth communication with the server and also ensure that messages from the server do not get "lost." Here I will discuss some of the more important ones, starting with the DoSynchronize ; procedure. 

The DoSynchronize; procedure is responsible for capturing and parsing all server communication. It receives three commands from the server: shutdown, lockstation and activate. Each of these will have further information attached to them. For example the activate command will come from the server in the following format:


This will be broken into three parts by the parse() procedure and then fed to the appropriate function for execution.

The ReadingThread code as listed below is responsible for reading all the communication from the server and then feeding it to the DoSynchronize; procedure.

procedure TReadingThread.Execute;


while not Terminated and FConn.Connected do





There are a few things that you need to do before using this application.

  • First, remove or comment out the btConnect procedure, and uncomment the FormCreate procedure. You need to do this because, when the application is first started, it has to connect to the server using the FormaCreate procedure and not the btConnect procedure, which I've been using for debugging purposes.

  • Set the path to where your ads will be located BEFORE starting the application. Simply open up the settings.ini file and then change the path. Be sure to use the same format as the example in the file.

  • Remove the oneClick procedure from the code.

blog comments powered by Disqus

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials